config: set system on default host config

This commit is contained in:
Gabriel Arazas 2023-12-16 20:02:22 +08:00
parent 1f74f96fc4
commit 10c3509121
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 9 additions and 8 deletions

View File

@ -358,7 +358,10 @@
]; ];
config = lib.mkMerge [ config = lib.mkMerge [
{ networking.hostName = lib.mkForce metadata.hostname or host; } {
networking.hostName = lib.mkForce metadata.hostname or host;
nixpkgs.hostPlatform = metadata._system;
}
(lib.mkIf (metadata ? domain) (lib.mkIf (metadata ? domain)
{ networking.domain = lib.mkForce metadata.domain; }) { networking.domain = lib.mkForce metadata.domain; })
@ -377,7 +380,6 @@
(host: metadata: (host: metadata:
mkHost { mkHost {
extraModules = [ (hostSpecificModule host metadata) ]; extraModules = [ (hostSpecificModule host metadata) ];
system = metadata._system;
nixpkgs-channel = metadata.nixpkgs-channel or "nixpkgs"; nixpkgs-channel = metadata.nixpkgs-channel or "nixpkgs";
}) })
(listImagesWithSystems images); (listImagesWithSystems images);
@ -453,7 +455,7 @@
format = metadata.format or "iso"; format = metadata.format or "iso";
in in
lib'.nameValuePair name (mkImage { lib'.nameValuePair name (mkImage {
inherit format system pkgs; inherit format pkgs;
extraModules = [ (hostSpecificModule host metadata) ]; extraModules = [ (hostSpecificModule host metadata) ];
})) }))
images'); images');

View File

@ -9,11 +9,10 @@ let
in in
{ {
# A wrapper around the NixOS configuration function. # A wrapper around the NixOS configuration function.
mkHost = { system, extraModules ? [ ], nixpkgs-channel ? "nixpkgs" }: mkHost = { extraModules ? [ ], nixpkgs-channel ? "nixpkgs" }:
let lib' = inputs.${nixpkgs-channel}.lib.extend extendLib; in let lib' = inputs.${nixpkgs-channel}.lib.extend extendLib; in
(lib'.makeOverridable lib'.nixosSystem) { (lib'.makeOverridable lib'.nixosSystem) {
# The system of the NixOS system. modules = extraModules;
modules = extraModules ++ [{ nixpkgs.hostPlatform = system; }];
}; };
# A wrapper around the home-manager configuration function. # A wrapper around the home-manager configuration function.
@ -25,9 +24,9 @@ in
}; };
# A wrapper around the nixos-generators `nixosGenerate` function. # A wrapper around the nixos-generators `nixosGenerate` function.
mkImage = { system, pkgs ? null, extraModules ? [ ], format ? "iso" }: mkImage = { pkgs ? null, extraModules ? [ ], format ? "iso" }:
inputs.nixos-generators.nixosGenerate { inputs.nixos-generators.nixosGenerate {
inherit pkgs system format; inherit pkgs format;
lib = pkgs.lib.extend extendLib; lib = pkgs.lib.extend extendLib;
modules = extraModules; modules = extraModules;
}; };