mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 22:11:33 +01:00
51 lines
1.2 KiB
Nix
51 lines
1.2 KiB
Nix
{
|
|
inputs,
|
|
self,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
mkHost =
|
|
hostName:
|
|
inputs.nixpkgs.lib.nixosSystem {
|
|
specialArgs = { inherit inputs self; };
|
|
modules =
|
|
let
|
|
hostFiles =
|
|
"${self}/hosts/${hostName}"
|
|
|> lib.filesystem.listFilesRecursive
|
|
|> lib.filter (lib.hasSuffix ".nix");
|
|
in
|
|
[
|
|
{ networking = { inherit hostName; }; }
|
|
"${self}/hosts/shared.nix"
|
|
]
|
|
++ hostFiles;
|
|
};
|
|
|
|
mkDeployNode = hostname: {
|
|
inherit hostname;
|
|
user = "root";
|
|
interactiveSudo = true;
|
|
profiles.system.path =
|
|
inputs.deploy-rs.lib.x86_64-linux.activate.nixos
|
|
self.nixosConfigurations.${hostname};
|
|
};
|
|
in
|
|
{
|
|
flake = {
|
|
nixosConfigurations =
|
|
"${self}/hosts"
|
|
|> builtins.readDir
|
|
|> lib.filterAttrs (_: type: type == "directory")
|
|
|> lib.mapAttrs (name: _: mkHost name);
|
|
|
|
deploy.nodes =
|
|
"${self}/hosts"
|
|
|> builtins.readDir
|
|
|> lib.filterAttrs (_: type: type == "directory")
|
|
|> lib.mapAttrs (name: _: mkDeployNode name);
|
|
|
|
checks = lib.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
|
|
};
|
|
}
|