nixos/home/common/optional/sops.nix

31 lines
947 B
Nix
Raw Normal View History

2024-05-17 20:17:53 +01:00
{ inputs, config, osConfig, ... }:
2024-05-12 19:58:55 +01:00
let
2024-05-14 14:51:09 +01:00
secretsDirectory = builtins.toString inputs.nix-secrets;
secretsFile = "${secretsDirectory}/secrets.yaml";
2024-05-12 19:58:55 +01:00
homeDirectory = config.home.homeDirectory;
2024-05-17 20:17:53 +01:00
username = config.home.username;
hostname = osConfig.networking.hostName;
2024-05-12 19:58:55 +01:00
in
{
imports = [
inputs.sops-nix.homeManagerModules.sops
];
sops = {
age.keyFile = "${homeDirectory}/.config/sops/age/keys.txt";
age.sshKeyPaths = ["${homeDirectory}/.ssh/deploy_key-ssh-ed25519" "${homeDirectory}/.ssh/ssh_host_ed25519_key"];
2024-05-12 19:58:55 +01:00
defaultSopsFile = "${secretsFile}";
validateSopsFiles = false;
2024-05-19 23:33:42 +01:00
secrets = {
"ssh_keys/${username}@${hostname}/${username}@${hostname}-ssh-ed25519" = {
path = "${homeDirectory}/.ssh/ssh_host_ed25519_key";
};
"ssh_keys/${username}@${hostname}/${username}@${hostname}-ssh-ed25519.pub" = {
path = "${homeDirectory}/.ssh/ssh_host_ed25519_key.pub";
};
};
2024-05-12 19:58:55 +01:00
};
}