Flake : Iterate hosts by dir name instead.
This commit is contained in:
parent
ce54548481
commit
762d8e4c79
17
flake.nix
17
flake.nix
|
@ -147,7 +147,7 @@
|
||||||
# Nixos systems.
|
# Nixos systems.
|
||||||
nixosConfigurations = let
|
nixosConfigurations = let
|
||||||
# Function to create a host. It does basic setup, like adding common modules.
|
# Function to create a host. It does basic setup, like adding common modules.
|
||||||
mkHost = { system, hostname, modules }: nixpkgs.lib.nixosSystem {
|
mkHost = { system, hostname }: nixpkgs.lib.nixosSystem {
|
||||||
# `Inherit` is just an alias for `system = system;`, which means that
|
# `Inherit` is just an alias for `system = system;`, which means that
|
||||||
# keep the `system` argument as a property in a resulting set.
|
# keep the `system` argument as a property in a resulting set.
|
||||||
inherit system;
|
inherit system;
|
||||||
|
@ -169,7 +169,6 @@
|
||||||
# HM config.
|
# HM config.
|
||||||
./home/NixOs.nix
|
./home/NixOs.nix
|
||||||
]
|
]
|
||||||
++ modules
|
|
||||||
++ (self.findFiles ./host/${system}/${hostname})
|
++ (self.findFiles ./host/${system}/${hostname})
|
||||||
++ (self.findFiles ./config)
|
++ (self.findFiles ./config)
|
||||||
++ (self.findFiles ./container)
|
++ (self.findFiles ./container)
|
||||||
|
@ -199,15 +198,19 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
mkSystem = hostname: system: modules: {
|
mkSystem = system: hostname: {
|
||||||
"${hostname}" = mkHost {
|
"${hostname}" = mkHost {
|
||||||
inherit hostname system modules;
|
inherit system hostname;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
x86System = hostname: mkSystem hostname "x86_64-linux" [];
|
|
||||||
in nixpkgs.lib.foldl' (acc: h: acc // h) {} (
|
in nixpkgs.lib.foldl' (acc: h: acc // h) {} (
|
||||||
map (host: x86System host) (builtins.attrNames (builtins.readDir ./host/x86_64-linux))
|
map (system:
|
||||||
|
nixpkgs.lib.foldl' (acc: h: acc // h) {} (
|
||||||
|
map (host:
|
||||||
|
mkSystem system host
|
||||||
|
) (builtins.attrNames (builtins.readDir ./host/${system}))
|
||||||
|
)
|
||||||
|
) (builtins.attrNames (builtins.readDir ./host))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue