Files
nix/hosts/common/configs/system/sops/default.nix
Nikolaos Karaolidis 15bf209e8c Refactor secrets
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-07-24 11:01:47 +01:00

35 lines
707 B
Nix

{
config,
inputs,
pkgs,
...
}:
{
imports = [ inputs.sops-nix.nixosModules.sops ];
environment = {
persistence."/persist/state"."/etc/ssh/ssh_host_ed25519_key" = { };
systemPackages = with pkgs; [
sops
age
ssh-to-age
];
};
sops = {
defaultSopsFile = "${inputs.secrets}/hosts/${config.networking.hostName}/secrets.yaml";
age = {
generateKey = true;
keyFile = "/var/lib/sops-nix/key.txt";
sshKeyPaths =
if config.environment.impermanence.enable then
[ config.environment.persistence."/persist/state"."/etc/ssh/ssh_host_ed25519_key".source ]
else
[ "/etc/ssh/ssh_host_ed25519_key" ];
};
};
}