diff --git a/flake.nix b/flake.nix index 97d6753..0b8d53d 100644 --- a/flake.nix +++ b/flake.nix @@ -45,6 +45,7 @@ system: let pkgs = import sources.nixos-unstable { inherit system; }; + inherit (pkgs) lib; tests = import ./tests { inherit pkgs; }; docs = import ./docs { inherit pkgs; }; in @@ -60,7 +61,9 @@ website = docs.website; }; - checks.wrapperManagerLibrarySetPkg = tests.libTestPkg; + checks = + { inherit (tests) lib; } + // lib.mapAttrs' (n: v: lib.nameValuePair "config-test-${n}" v) tests.configs; } )); } diff --git a/tests/configs/default.nix b/tests/configs/default.nix index 951c416..a0506e8 100644 --- a/tests/configs/default.nix +++ b/tests/configs/default.nix @@ -7,11 +7,14 @@ in let wmLib = (import ../../. { }).lib; - build = modules: wmLib.build { inherit pkgs modules; }; + build = args: wmLib.build (args // { inherit pkgs; }); in { - fastfetch = build [ ./wrapper-fastfetch.nix ]; - neofetch = build [ ./wrapper-neofetch.nix ]; - single-basepackage = build [ ./single-basepackage.nix ]; - neofetch-with-additional-files = build [ ./neofetch-with-additional-files.nix ]; + fastfetch = build { modules = [ ./wrapper-fastfetch.nix ]; }; + neofetch = build { + modules = [ ./wrapper-neofetch.nix ]; + specialArgs.yourMomName = "Yor mom"; + }; + single-basepackage = build { modules = [ ./single-basepackage.nix ]; }; + neofetch-with-additional-files = build { modules = [ ./neofetch-with-additional-files.nix ]; }; } diff --git a/tests/configs/neofetch-with-additional-files.nix b/tests/configs/neofetch-with-additional-files.nix index 4186ddc..91dd953 100644 --- a/tests/configs/neofetch-with-additional-files.nix +++ b/tests/configs/neofetch-with-additional-files.nix @@ -37,7 +37,7 @@ WHAT ''; - build.extraPassthru.tests = { + build.extraPassthru.wrapperManagerTests = { actuallyBuilt = let wrapper = config.build.toplevel; diff --git a/tests/configs/single-basepackage.nix b/tests/configs/single-basepackage.nix index 5063786..7d2aac0 100644 --- a/tests/configs/single-basepackage.nix +++ b/tests/configs/single-basepackage.nix @@ -13,7 +13,7 @@ xdg.desktopEntry.enable = true; }; - build.extraPassthru.tests = { + build.extraPassthru.wrapperManagerTests = { singleBasePackage = let wrapper = config.build.toplevel; diff --git a/tests/configs/wrapper-fastfetch.nix b/tests/configs/wrapper-fastfetch.nix index 93a291f..9980853 100644 --- a/tests/configs/wrapper-fastfetch.nix +++ b/tests/configs/wrapper-fastfetch.nix @@ -23,7 +23,7 @@ hello ]); - build.extraPassthru.tests = { + build.extraPassthru.wrapperManagerTests = { actuallyBuilt = let wrapper = config.build.toplevel; diff --git a/tests/configs/wrapper-neofetch.nix b/tests/configs/wrapper-neofetch.nix index 4ca2f89..7e3041a 100644 --- a/tests/configs/wrapper-neofetch.nix +++ b/tests/configs/wrapper-neofetch.nix @@ -20,7 +20,7 @@ ]; }; - build.extraPassthru.tests = { + build.extraPassthru.wrapperManagerTests = { actuallyBuilt = let wrapper = config.build.toplevel; diff --git a/tests/default.nix b/tests/default.nix index eb6b6ec..f23bc47 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -6,14 +6,20 @@ in }: let - lib = import ./lib { inherit pkgs; }; + wrapperManagerLibTests = import ./lib { inherit pkgs; }; + inherit (pkgs) lib; in { - inherit lib; - libTestPkg = + configs = let + configs' = import ./configs { inherit pkgs; }; + updateTestName = configName: package: lib.mapAttrs' (n: v: lib.nameValuePair "${configName}-${n}" v) package.wrapperManagerTests; + in + lib.concatMapAttrs updateTestName configs'; + + lib = pkgs.runCommand "wrapper-manager-fds-lib-test" { - testData = builtins.toJSON lib; + testData = builtins.toJSON wrapperManagerLibTests; passAsFile = [ "testData" ]; nativeBuildInputs = with pkgs; [ yajsv @@ -23,5 +29,4 @@ in '' yajsv -s "${./lib/tests.schema.json}" "$testDataPath" && touch $out || jq . "$testDataPath" ''; - configs = import ./configs { inherit pkgs; }; }