config/utils.nix

45 lines
1.3 KiB
Nix

{
mkSystem =
{ hostConfig }:
{ inputs, ... }:
{
imports = [
inputs.impermanence.nixosModules.impermanence
inputs.sops-nix.nixosModules.sops
./systems/base/configuration.nix
(
{ ... }:
{
sops.defaultSopsFile = ./secrets + "/${hostConfig.hostname}.yaml";
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
# Disable automatic pgp key generation based on ssh keys
sops.gnupg.sshKeyPaths = [ ];
networking = {
hostName = hostConfig.hostname;
interfaces.ens18.ipv4.addresses = [
{
address = hostConfig.ip;
prefixLength = 24;
}
];
nameservers = [ "192.168.10.1" ];
defaultGateway = {
address = "192.168.10.1";
interface = "ens18";
};
};
system.stateVersion = hostConfig.stateVersion;
}
)
({ ... }: hostConfig.config)
] ++ builtins.map (role: role.nixosModule) hostConfig.roles;
};
mkRole = cfg: {
inherit (cfg) name description nixosModule;
traefikRoutes = cfg.traefikRoutes or ({ ... }: [ ]);
};
}