2025-02-04 05:26:51 +01:00
|
|
|
{
|
|
|
|
inputs,
|
2025-02-05 16:19:19 +01:00
|
|
|
homelabConfig,
|
2025-02-04 05:26:51 +01:00
|
|
|
...
|
|
|
|
}:
|
2024-11-17 20:28:14 +01:00
|
|
|
{
|
|
|
|
mkSystem =
|
2025-02-04 05:20:25 +01:00
|
|
|
{ hostConfig }:
|
|
|
|
{
|
2025-02-04 05:26:51 +01:00
|
|
|
deployment = {
|
|
|
|
targetHost = hostConfig.ip;
|
|
|
|
targetUser = "maintenance";
|
|
|
|
};
|
|
|
|
|
2025-02-04 05:20:25 +01:00
|
|
|
imports = [
|
2024-11-22 18:05:37 +01:00
|
|
|
inputs.impermanence.nixosModules.impermanence
|
2024-12-26 19:41:49 +01:00
|
|
|
inputs.sops-nix.nixosModules.sops
|
2024-12-26 17:22:00 +01:00
|
|
|
|
|
|
|
./systems/base/configuration.nix
|
|
|
|
(
|
|
|
|
{ ... }:
|
|
|
|
{
|
2024-12-26 19:41:49 +01:00
|
|
|
sops.defaultSopsFile = ./secrets + "/${hostConfig.hostname}.yaml";
|
2024-12-26 20:22:43 +01:00
|
|
|
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
2024-12-26 19:41:49 +01:00
|
|
|
# Disable automatic pgp key generation based on ssh keys
|
|
|
|
sops.gnupg.sshKeyPaths = [ ];
|
|
|
|
|
2025-02-03 17:23:12 +01:00
|
|
|
networking = {
|
|
|
|
hostName = hostConfig.hostname;
|
2025-02-04 05:26:51 +01:00
|
|
|
interfaces.eth0.ipv4.addresses = [
|
2025-02-03 17:23:12 +01:00
|
|
|
{
|
|
|
|
address = hostConfig.ip;
|
|
|
|
prefixLength = 24;
|
|
|
|
}
|
|
|
|
];
|
2025-02-05 16:19:19 +01:00
|
|
|
nameservers = homelabConfig.defaultDNS;
|
2025-02-03 17:23:12 +01:00
|
|
|
defaultGateway = {
|
2025-02-05 16:19:19 +01:00
|
|
|
address = homelabConfig.defaultGateway;
|
2025-02-04 05:26:51 +01:00
|
|
|
interface = "eth0";
|
2025-02-03 17:23:12 +01:00
|
|
|
};
|
|
|
|
};
|
2024-12-26 17:22:00 +01:00
|
|
|
system.stateVersion = hostConfig.stateVersion;
|
|
|
|
}
|
|
|
|
)
|
|
|
|
({ ... }: hostConfig.config)
|
|
|
|
] ++ builtins.map (role: role.nixosModule) hostConfig.roles;
|
2024-11-17 20:28:14 +01:00
|
|
|
};
|
2024-12-26 17:22:00 +01:00
|
|
|
|
|
|
|
mkRole = cfg: {
|
|
|
|
inherit (cfg) name description nixosModule;
|
|
|
|
traefikRoutes = cfg.traefikRoutes or ({ ... }: [ ]);
|
|
|
|
};
|
2025-02-05 16:19:19 +01:00
|
|
|
|
|
|
|
mkHost = cfg: {
|
|
|
|
inherit (cfg)
|
|
|
|
hostname
|
|
|
|
managed
|
|
|
|
ip
|
|
|
|
stateVersion
|
|
|
|
;
|
|
|
|
traefikRoutes = cfg.traefikRoutes or [ ];
|
|
|
|
roles = cfg.roles or [ ];
|
|
|
|
config = cfg.config or { };
|
|
|
|
};
|
2024-11-17 20:28:14 +01:00
|
|
|
}
|