Merge pull request 'build-clan: fix specialArgs not passed' (#1845) from DavHau/clan-core:DavHau-dave into main

This commit is contained in:
clan-bot
2024-08-04 06:10:37 +00:00
3 changed files with 27 additions and 7 deletions

View File

@@ -25,7 +25,8 @@ let
specialArgs specialArgs
clan-core clan-core
; ;
} { self = directory; }; self = directory;
};
meta = attrs.meta or { }; meta = attrs.meta or { };
rest = builtins.removeAttrs attrs [ rest = builtins.removeAttrs attrs [
"meta" "meta"

View File

@@ -3,16 +3,17 @@
nixpkgs, nixpkgs,
clan-core, clan-core,
specialArgs ? { }, specialArgs ? { },
self,
}: }:
# Returns a function that takes self, which should point to the directory of the flake # Returns a function that takes self, which should point to the directory of the flake
{ self }:
module: module:
(lib.evalModules { (lib.evalModules {
specialArgs = { specialArgs = {
inherit self clan-core nixpkgs; inherit self clan-core nixpkgs;
} // specialArgs; };
modules = [ modules = [
./interface.nix ./interface.nix
module module
{ inherit specialArgs; }
]; ];
}).config }).config

View File

@@ -6,10 +6,10 @@
... ...
}: }:
let let
eval = import ./eval.nix { inherit lib nixpkgs clan-core; }; evalClan = import ./eval.nix {
inherit lib nixpkgs clan-core;
self = ./.; self = ./.;
evalClan = eval { inherit self; }; };
in in
####### #######
@@ -131,4 +131,22 @@ in
"machine2" "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";
};
} }