1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-10 21:29:48 +01:00

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 Mikilio
parent 14dd7d71fb
commit d44e73cb27
No known key found for this signature in database
GPG key ID: 5B2F1A890CF33F3F

View file

@ -106,12 +106,18 @@
packages = forAllSystems (system: packages = forAllSystems (system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;
releaseInfo = nixpkgs.lib.importJSON ./release.json; releaseInfo = nixpkgs.lib.importJSON ./release.json;
docs = import ./docs { docs = import ./docs {
inherit pkgs; inherit pkgs;
inherit (releaseInfo) release isReleaseBranch; inherit (releaseInfo) release isReleaseBranch;
}; };
hmPkg = pkgs.callPackage ./home-manager { path = toString ./.; }; 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 { in {
default = hmPkg; default = hmPkg;
home-manager = hmPkg; home-manager = hmPkg;
@ -119,7 +125,7 @@
docs-html = docs.manual.html; docs-html = docs.manual.html;
docs-json = docs.options.json; docs-json = docs.options.json;
docs-manpages = docs.manPages; docs-manpages = docs.manPages;
}); } // testPackages);
defaultPackage = forAllSystems (system: self.packages.${system}.default); defaultPackage = forAllSystems (system: self.packages.${system}.default);
}); });