refactor 2/2: simplify hosts layout

This commit is contained in:
Sean Buckley 2024-05-29 00:51:09 -04:00
parent e8468c1aa5
commit 981bd80d46
5 changed files with 30 additions and 21 deletions

View file

@ -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});

View file

@ -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
View file

@ -0,0 +1,6 @@
{
system = "x86_64-linux";
modules = [
./configuration.nix
];
}

6
hosts/levi/default.nix Normal file
View file

@ -0,0 +1,6 @@
{
system = "x86_64-linux";
modules = [
./configuration.nix
];
}

View file

@ -0,0 +1,6 @@
{
system = "x86_64-linux";
modules = [
./configuration.nix
];
}