diff --git a/modules/aspects/provides/flake-parts/inputs.nix b/modules/aspects/provides/flake-parts/inputs.nix index d12362f9..cca051d4 100644 --- a/modules/aspects/provides/flake-parts/inputs.nix +++ b/modules/aspects/provides/flake-parts/inputs.nix @@ -48,7 +48,9 @@ let user, host, }: - lib.mkMerge (map (c: mkAspect c host.system) user.classes); + { + includes = map (c: mkAspect c host.system) user.classes; + }; hmAspect = { home }: mkAspect home.class home.system; diff --git a/modules/aspects/provides/flake-parts/self.nix b/modules/aspects/provides/flake-parts/self.nix index 6f491a97..6a48f2d0 100644 --- a/modules/aspects/provides/flake-parts/self.nix +++ b/modules/aspects/provides/flake-parts/self.nix @@ -48,7 +48,9 @@ let user, host, }: - lib.mkMerge (map (c: mkAspect c host.system) user.classes); + { + includes = map (c: mkAspect c host.system) user.classes; + }; homeAspect = { home }: mkAspect home.class home.system; in diff --git a/templates/ci/modules/features/deadbugs/issue-369-namespace-system-scoped-inputs.nix b/templates/ci/modules/features/deadbugs/issue-369-namespace-system-scoped-inputs.nix new file mode 100644 index 00000000..3e671239 --- /dev/null +++ b/templates/ci/modules/features/deadbugs/issue-369-namespace-system-scoped-inputs.nix @@ -0,0 +1,94 @@ +{ denTest, ... }: +{ + flake.tests.deadbugs-issue-369 = { + + test-self-arg-includes = denTest ( + { + den, + lib, + inputs, + tuxHm, + ... + }: + { + den.hosts.x86_64-linux.igloo.users.tux = { }; + den.default.homeManager.home.stateVersion = "25.11"; + + den.default.includes = [ den._.self' ]; + den.aspects.tux.includes = [ den.aspects.hola ]; + + den.aspects.hola.homeManager = + { self', ... }@args: + { + home.sessionVariables.FOO = lib.getName self'.legacyPackages.hello; + }; + + expr = tuxHm.home.sessionVariables.FOO; + expected = "hello"; + } + ); + + test-inputs-arg-includes = denTest ( + { + den, + lib, + inputs, + tuxHm, + ... + }: + { + den.hosts.x86_64-linux.igloo.users.tux = { }; + den.default.homeManager.home.stateVersion = "25.11"; + + den.default.includes = [ den._.inputs' ]; + den.aspects.tux.includes = [ den.aspects.hola ]; + + den.aspects.hola.homeManager = + { inputs', ... }@args: + { + home.sessionVariables.FOO = lib.getName inputs'.nixpkgs.legacyPackages.hello; + }; + + expr = tuxHm.home.sessionVariables.FOO; + expected = "hello"; + } + ); + + test-everything-includes = denTest ( + { + den, + lib, + igloo, + inputs, + gloom, + __findFile, + tuxHm, + ... + }: + { + imports = [ (inputs.den.namespace "gloom" false) ]; + _module.args.__findFile = den.lib.__findFile; + + den.hosts.x86_64-linux.igloo.users.tux = { }; + den.default.homeManager.home.stateVersion = "25.11"; + + den.default.includes = [ + den._.inputs' + den._.define-user + ]; + den.aspects.tux.includes = [ gloom.everywhere ]; + gloom.everywhere.includes = [ ]; + + gloom.apps.provides.helix.homeManager = + { inputs', ... }@args: + { + home.packages = [ inputs'.nixpkgs.legacyPackages.hello ]; + }; + + expr = builtins.elem "hello" (map lib.getName tuxHm.home.packages); + expected = true; + } + ); + + }; +} diff --git a/templates/ci/modules/test-support/eval-den.nix b/templates/ci/modules/test-support/eval-den.nix index 47bad3fd..8c107259 100644 --- a/templates/ci/modules/test-support/eval-den.nix +++ b/templates/ci/modules/test-support/eval-den.nix @@ -9,12 +9,15 @@ let inherit ((evalDen module).config) expr expected; }; - # fake-parts + # emulate fake-parts only for self and nixpkgs. withSystem = system: let - inputs' = builtins.mapAttrs (_: builtins.mapAttrs (_: value: value.${system})) inputs; - self'.packages.hello = inputs.nixpkgs.legacyPackages.${system}.hello; + pkgs = inputs.nixpkgs.legacyPackages.${system}; + inputs'.nixpkgs.packages = pkgs; + inputs'.nixpkgs.legacyPackages = pkgs; + self'.packages = pkgs; + self'.legacyPackages = pkgs; in cb: cb { inherit inputs' self'; };