nixos/hosts/common/core/sops.nix

30 lines
715 B
Nix
Raw Permalink Normal View History

2024-05-25 16:31:51 +01:00
{ pkgs, lib, inputs, config, ... }:
2024-05-23 10:48:00 +01:00
2024-05-12 19:58:55 +01:00
let
2024-05-14 14:51:09 +01:00
secretsDirectory = builtins.toString inputs.nix-secrets;
2024-05-12 19:58:55 +01:00
secretsFile = "${secretsDirectory}/secrets.yaml";
2024-05-25 18:34:37 +01:00
hasOptinPersistence = config.environment.persistence ? "/persist";
2024-05-23 13:19:21 +01:00
hostname = config.networking.hostName;
2024-05-25 16:31:51 +01:00
2024-05-12 19:58:55 +01:00
in
{
imports = [
inputs.sops-nix.nixosModules.sops
];
sops = {
defaultSopsFile = "${secretsFile}";
validateSopsFiles = false;
2024-05-19 23:33:42 +01:00
age = {
sshKeyPaths = [ "${lib.optionalString hasOptinPersistence "/persist"}/etc/ssh/ssh_host_ed25519_key" ];
};
2024-06-17 20:20:33 +01:00
secrets = {
"passwords/root".neededForUsers = true;
"ssh_keys/deploy_key/id_ed25519" = {
path = "/etc/ssh/deploy_key-ssh-ed25519";
};
2024-05-23 10:48:00 +01:00
};
2024-05-12 19:58:55 +01:00
};
}