fixup(buildClan): split up the inner-module into: {forSystem, forName}
I am preparing this such that we can move the forName modules into the defaults for the deferred module outputs and the forSystem modules are added later and only for the 'configsPerSystem' where we actually need the system modules
This commit is contained in:
28
lib/build-clan/machineModules/forName.nix
Normal file
28
lib/build-clan/machineModules/forName.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
name,
|
||||
directory,
|
||||
}:
|
||||
{
|
||||
_class,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
{
|
||||
imports = builtins.filter builtins.pathExists (
|
||||
[
|
||||
"${directory}/machines/${name}/configuration.nix"
|
||||
]
|
||||
++ lib.optionals (_class == "nixos") [
|
||||
"${directory}/machines/${name}/hardware-configuration.nix"
|
||||
"${directory}/machines/${name}/disko.nix"
|
||||
]
|
||||
);
|
||||
}
|
||||
# TODO: move into nixos modules
|
||||
({
|
||||
networking.hostName = lib.mkDefault name;
|
||||
})
|
||||
];
|
||||
}
|
||||
26
lib/build-clan/machineModules/forSystem.nix
Normal file
26
lib/build-clan/machineModules/forSystem.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
pkgs,
|
||||
pkgsForSystem,
|
||||
system,
|
||||
}:
|
||||
{
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
(
|
||||
{
|
||||
# For vars we need to override the system so we run vars
|
||||
# generators on the machine that runs `clan vars generate`. If a
|
||||
# users is using the `pkgsForSystem`, we don't set
|
||||
# nixpkgs.hostPlatform it would conflict with the `nixpkgs.pkgs`
|
||||
# option.
|
||||
nixpkgs.hostPlatform = lib.mkIf (system != null && (pkgsForSystem system) != null) (
|
||||
lib.mkForce system
|
||||
);
|
||||
}
|
||||
// lib.optionalAttrs (pkgs != null) { nixpkgs.pkgs = lib.mkForce pkgs; }
|
||||
)
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user