mirror of
https://github.com/tuxdotrs/nix-config.git
synced 2026-06-17 10:16:31 +05:30
feat: setup sops-nix
This commit is contained in:
25
modules/nixos/core/sops.nix
Normal file
25
modules/nixos/core/sops.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
flake.modules.nixos.core =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
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;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ sops ];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user