config/utils.nix

46 lines
1.1 KiB
Nix
Raw Normal View History

2024-11-17 20:28:14 +01:00
{
nixpkgs,
inputs,
outputs,
...
}:
{
mkSystem =
2024-12-26 19:20:22 +01:00
{ hostConfig, hosts }:
2024-11-17 20:28:14 +01:00
nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
2024-12-26 19:20:22 +01:00
inherit
inputs
outputs
hostConfig
hosts
;
2024-11-17 20:28:14 +01:00
};
2024-12-26 17:22:00 +01:00
modules = [
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 = [ ];
2024-12-26 17:22:00 +01:00
networking.hostName = hostConfig.hostname;
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 ({ ... }: [ ]);
};
2024-11-17 20:28:14 +01:00
}