diff --git a/lib/build-clan/default.nix b/lib/build-clan/default.nix index 773036424..ca9ae4572 100644 --- a/lib/build-clan/default.nix +++ b/lib/build-clan/default.nix @@ -25,7 +25,8 @@ let specialArgs clan-core ; - } { self = directory; }; + self = directory; + }; meta = attrs.meta or { }; rest = builtins.removeAttrs attrs [ "meta" diff --git a/lib/build-clan/eval.nix b/lib/build-clan/eval.nix index a1ed4a623..123d980f0 100644 --- a/lib/build-clan/eval.nix +++ b/lib/build-clan/eval.nix @@ -3,16 +3,17 @@ nixpkgs, clan-core, specialArgs ? { }, + self, }: # Returns a function that takes self, which should point to the directory of the flake -{ self }: module: (lib.evalModules { specialArgs = { inherit self clan-core nixpkgs; - } // specialArgs; + }; modules = [ ./interface.nix module + { inherit specialArgs; } ]; }).config diff --git a/lib/build-clan/tests.nix b/lib/build-clan/tests.nix index 2d78f42b3..a4982b437 100644 --- a/lib/build-clan/tests.nix +++ b/lib/build-clan/tests.nix @@ -6,10 +6,10 @@ ... }: let - eval = import ./eval.nix { inherit lib nixpkgs clan-core; }; - - self = ./.; - evalClan = eval { inherit self; }; + evalClan = import ./eval.nix { + inherit lib nixpkgs clan-core; + self = ./.; + }; in ####### @@ -131,4 +131,22 @@ in "machine2" ]; }; + + test_buildClan_specialArgs = + let + result = buildClan { + directory = ./.; + meta.name = "test"; + specialArgs.foo = "dream2nix"; + machines.machine2 = + { foo, ... }: + { + networking.hostName = foo; + }; + }; + in + { + expr = result.nixosConfigurations.machine2.config.networking.hostName; + expected = "dream2nix"; + }; }