mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 15:11: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
|
let
|
||||||
specialArgs = {
|
unstable = inputs.nixpkgs;
|
||||||
inherit inputs self;
|
stable = inputs.nixpkgs-stable;
|
||||||
|
|
||||||
|
mkHost = hostname: nixpkgs: {
|
||||||
|
${hostname} = nixpkgs.lib.nixosSystem {
|
||||||
|
specialArgs = {
|
||||||
|
inherit inputs self;
|
||||||
|
};
|
||||||
|
modules =
|
||||||
|
[
|
||||||
|
{ networking.hostName = hostname; }
|
||||||
|
"${self}/hosts/${hostname}"
|
||||||
|
]
|
||||||
|
++ builtins.filter (path: builtins.pathExists path) (
|
||||||
|
map (user: "${self}/users/${user}/@${hostname}") (
|
||||||
|
builtins.attrNames (lib.filterAttrs (_: v: v == "directory") (builtins.readDir "${self}/users"))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
modulesOf = hostname: [
|
|
||||||
{ networking.hostName = hostname; }
|
|
||||||
"${self}/hosts/${hostname}"
|
|
||||||
"${self}/users/seb/@${hostname}"
|
|
||||||
];
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.nixosConfigurations = {
|
flake.nixosConfigurations = lib.mkMerge [
|
||||||
north = inputs.nixpkgs.lib.nixosSystem {
|
(mkHost "north" unstable)
|
||||||
inherit specialArgs;
|
(mkHost "inspiron" unstable)
|
||||||
modules = modulesOf "north";
|
(mkHost "installer" stable)
|
||||||
};
|
];
|
||||||
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"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue