mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 17:31:34 +01:00
Refactor host entrypoints again
This commit is contained in:
parent
09f0de731a
commit
1bdbed129e
1 changed files with 31 additions and 25 deletions
|
|
@ -1,30 +1,36 @@
|
|||
{ inputs, self, ... }:
|
||||
{
|
||||
inputs,
|
||||
self,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
unstable = inputs.nixpkgs;
|
||||
stable = inputs.nixpkgs-stable;
|
||||
|
||||
mkHost = hostname: nixpkgs: {
|
||||
${hostname} = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit inputs self;
|
||||
};
|
||||
modulesOf = hostname: [
|
||||
modules =
|
||||
[
|
||||
{ networking.hostName = hostname; }
|
||||
"${self}/hosts/${hostname}"
|
||||
"${self}/users/seb/@${hostname}"
|
||||
];
|
||||
]
|
||||
++ builtins.filter (path: builtins.pathExists path) (
|
||||
map (user: "${self}/users/${user}/@${hostname}") (
|
||||
builtins.attrNames (lib.filterAttrs (_: v: v == "directory") (builtins.readDir "${self}/users"))
|
||||
)
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
flake.nixosConfigurations = {
|
||||
north = inputs.nixpkgs.lib.nixosSystem {
|
||||
inherit specialArgs;
|
||||
modules = modulesOf "north";
|
||||
};
|
||||
inspiron = inputs.nixpkgs.lib.nixosSystem {
|
||||
inherit specialArgs;
|
||||
modules = modulesOf "inspiron";
|
||||
};
|
||||
installer = inputs.nixpkgs-stable.lib.nixosSystem {
|
||||
inherit specialArgs;
|
||||
modules = [
|
||||
{ networking.hostName = "installer"; }
|
||||
"${self}/hosts/installer"
|
||||
flake.nixosConfigurations = lib.mkMerge [
|
||||
(mkHost "north" unstable)
|
||||
(mkHost "inspiron" unstable)
|
||||
(mkHost "installer" stable)
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue