diff --git a/nixos/secrets.nix b/nixos/secrets.nix index bc391b40..320787ba 100644 --- a/nixos/secrets.nix +++ b/nixos/secrets.nix @@ -10,11 +10,15 @@ systemd.user.services.import-gpg-key = { Unit = { Description = "Import GPG private key"; + After = [ "agenix.service" ]; }; + Install.WantedBy = [ "default.target" ]; Service = { Type = "oneshot"; - ExecStart = "${pkgs.gnupg}/bin/gpg --batch --import /run/user/%U/agenix/gpg-keys"; + ExecStart = + let path = config.age.secrets.gpg-keys.path; + in "${pkgs.gnupg}/bin/gpg --batch --import ${path}"; }; }; });