mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +00:00
refactor 2/2: simplify hosts layout
This commit is contained in:
parent
e8468c1aa5
commit
981bd80d46
5 changed files with 30 additions and 21 deletions
15
flake.nix
15
flake.nix
|
@ -56,9 +56,18 @@
|
|||
})
|
||||
(builtins.readDir ./modules);
|
||||
|
||||
nixosConfigurations = builtins.mapAttrs
|
||||
(_: lib.nixosSystem)
|
||||
(import ./hosts { imports = builtins.attrValues self.nixosModules; });
|
||||
nixosConfigurations = lib.genAttrs
|
||||
(builtins.attrNames (builtins.readDir ./hosts))
|
||||
(name:
|
||||
let cfg = import (./hosts + "/${name}");
|
||||
in lib.nixosSystem {
|
||||
inherit (cfg) system;
|
||||
modules =
|
||||
cfg.modules ++
|
||||
[{ networking.hostName = name; }] ++
|
||||
(builtins.attrValues self.nixosModules);
|
||||
}
|
||||
);
|
||||
|
||||
packages = forAllSystems (system:
|
||||
mypkgs nixpkgs.legacyPackages.${system});
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
nixosModule:
|
||||
|
||||
builtins.mapAttrs
|
||||
|
||||
(name: system: {
|
||||
inherit system;
|
||||
modules = [
|
||||
nixosModule
|
||||
(./. + "/${name}")
|
||||
{ networking.hostName = name; }
|
||||
];
|
||||
})
|
||||
|
||||
{
|
||||
hp = "x86_64-linux";
|
||||
levi = "x86_64-linux";
|
||||
testbox = "x86_64-linux";
|
||||
}
|
6
hosts/hp/default.nix
Normal file
6
hosts/hp/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./configuration.nix
|
||||
];
|
||||
}
|
6
hosts/levi/default.nix
Normal file
6
hosts/levi/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./configuration.nix
|
||||
];
|
||||
}
|
6
hosts/testbox/default.nix
Normal file
6
hosts/testbox/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./configuration.nix
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue