move sops to modules

This commit is contained in:
2024-08-08 14:09:44 +05:30
parent fd92021844
commit 42a23950d6
6 changed files with 123 additions and 20 deletions

17
modules/nixos/sops.nix Normal file
View File

@ -0,0 +1,17 @@
{
inputs,
config,
...
}: let
isEd25519 = k: k.type == "ed25519";
getKeyPath = k: k.path;
keys = builtins.filter isEd25519 config.services.openssh.hostKeys;
in {
imports = [inputs.sops-nix.nixosModules.sops];
sops.age = {
sshKeyPaths = map getKeyPath keys;
keyFile = "/var/lib/sops-nix/key.txt";
generateKey = true;
};
}