From a28c473b5719594e8848dba102263bcc38099872 Mon Sep 17 00:00:00 2001 From: Yannik Sander Date: Tue, 23 Nov 2021 13:58:38 +0100 Subject: [PATCH] Add flake app and Documentation (#364) * Add flake app * Document adding and testing own flakes --- README.md | 12 ++++++++++++ flake.nix | 12 +++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0299e4e..29213c3 100644 --- a/README.md +++ b/README.md @@ -58,3 +58,15 @@ application. - GitHub Action can also be triggered via Pull Request, which if Pull Request was created from a non-forked repo's branch, will provide a preview url in a comment. + +## Adding flakes + +To add your own flakes to the search index edit [./flakes/manual.toml](./flakes/manual.toml). + +Possible types are `github`, `gitlab`, and `git` (which is the fallback for any kind of git repository but requires to set a revision key manually as of now). + +To test whether your flake is compatible with nix flake-info you can try running `flake-info` against it + +``` +$ nix run github:nixos/nixos-search#apps.flake-info -- flake +``` diff --git a/flake.nix b/flake.nix index ba4e722..6bf2d7b 100644 --- a/flake.nix +++ b/flake.nix @@ -13,7 +13,7 @@ let pkgs = import nixpkgs { inherit system; - overlays = [ ]; + overlays = []; }; in import path { inherit pkgs; }; @@ -28,10 +28,20 @@ inputsFrom = builtins.attrValues (packages system); NIXPKGS_PANDOC_FILTERS_PATH = "${nixpkgs + "/doc/build-aux/pandoc-filters"}"; }; + + apps = system: + { + flake-info = { + type = "app"; + program = "${(packages system).flake_info}/bin/flake-info"; + }; + }; in { defaultPackage = forAllSystems (mkPackage ./.); packages = forAllSystems packages; devShell = forAllSystems devShell; + apps = forAllSystems apps; + defaultApp = forAllSystems (system: (apps system).flake-info); }; }