mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
move "nixosSystem" step out of getHosts
This commit is contained in:
parent
05bee65c5d
commit
bbafad8487
2 changed files with 23 additions and 20 deletions
10
flake.nix
10
flake.nix
|
@ -43,11 +43,13 @@
|
||||||
nixpkgs.overlays = [ (_: mypkgs) ];
|
nixpkgs.overlays = [ (_: mypkgs) ];
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosConfigurations = getHosts {
|
nixosConfigurations =
|
||||||
path = ./hosts;
|
builtins.mapAttrs
|
||||||
inherit nixpkgs;
|
(_: nixpkgs.lib.nixosSystem)
|
||||||
|
(getHosts {
|
||||||
inherit (self) nixosModule;
|
inherit (self) nixosModule;
|
||||||
};
|
path = ./hosts;
|
||||||
|
});
|
||||||
|
|
||||||
packages = forAllSystems
|
packages = forAllSystems
|
||||||
(system: mypkgs nixpkgs.legacyPackages.${system});
|
(system: mypkgs nixpkgs.legacyPackages.${system});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ path, nixpkgs, nixosModule }:
|
{ path, nixosModule }:
|
||||||
let
|
let
|
||||||
|
|
||||||
inherit (builtins) mapAttrs attrValues attrNames readDir foldl' listToAttrs;
|
inherit (builtins) mapAttrs attrValues attrNames readDir foldl' listToAttrs;
|
||||||
|
@ -17,18 +17,19 @@ let
|
||||||
(system: hosts: listToAttrs (map (name: { inherit name; value = system; }) hosts))
|
(system: hosts: listToAttrs (map (name: { inherit name; value = system; }) hosts))
|
||||||
sysToHosts));
|
sysToHosts));
|
||||||
|
|
||||||
# build system configurations
|
in
|
||||||
# { host1 = <nixosConfiguration>; host2 = <nixosConfiguration>; }
|
# produce stub configurations
|
||||||
hostToConfig = mapAttrs
|
# {
|
||||||
(hostName: system: nixpkgs.lib.nixosSystem {
|
# host1 = { system = "x86_64-linux"; modules = [ ... ]; };
|
||||||
|
# host2 = { system = "x86_64-linux"; modules = [ ... ]; };
|
||||||
|
# }
|
||||||
|
mapAttrs
|
||||||
|
(hostName: system: {
|
||||||
inherit system;
|
inherit system;
|
||||||
modules = [
|
modules = [
|
||||||
(nixosModule)
|
(nixosModule)
|
||||||
(path + "/${system}/${hostName}")
|
(path + "/${system}/${hostName}")
|
||||||
(_: { networking.hostName = hostName; })
|
{ networking = { inherit hostName; }; }
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
hostToSys;
|
hostToSys
|
||||||
|
|
||||||
in
|
|
||||||
hostToConfig
|
|
||||||
|
|
Loading…
Reference in a new issue