flake: add packages for tests

With this it is possible to build a specific test by running

    $ nix build -L .#test-{test name}

For example

    $ nix build -L .#test-files-text
This commit is contained in:
Robert Helgesson 2023-12-14 08:05:51 +01:00 committed by GitHub
parent 7a88cdedbd
commit be97e96dab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -106,12 +106,18 @@
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
releaseInfo = nixpkgs.lib.importJSON ./release.json;
docs = import ./docs {
inherit pkgs;
inherit (releaseInfo) release isReleaseBranch;
};
hmPkg = pkgs.callPackage ./home-manager { path = toString ./.; };
testPackages = let
tests = import ./tests { inherit pkgs; };
renameTestPkg = n: lib.nameValuePair "test-${n}";
in lib.mapAttrs' renameTestPkg tests.build;
in {
default = hmPkg;
home-manager = hmPkg;
@ -119,7 +125,7 @@
docs-html = docs.manual.html;
docs-json = docs.options.json;
docs-manpages = docs.manPages;
});
} // testPackages);
defaultPackage = forAllSystems (system: self.packages.${system}.default);
});