2023-08-22 15:48:29 -06:00
|
|
|
{ inputs, pkgs, ... }: {
|
|
|
|
home-manager.users.imalison = ({ config, ... }: {
|
|
|
|
imports = [ inputs.agenix.homeManagerModules.default ];
|
|
|
|
age.identityPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ];
|
|
|
|
home.packages = [
|
|
|
|
inputs.agenix.packages."${pkgs.system}".default
|
|
|
|
];
|
|
|
|
age.secrets.gpg-keys.file = ./secrets/gpg-keys.age;
|
2023-08-22 19:14:08 -06:00
|
|
|
age.secrets.gpg-passphrase.file = ./secrets/gpg-passphrase.age;
|
2023-08-22 15:48:29 -06:00
|
|
|
|
|
|
|
systemd.user.services.import-gpg-key = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Import GPG private key";
|
2023-08-22 18:00:31 -06:00
|
|
|
After = [ "agenix.service" ];
|
2023-08-22 18:07:27 -06:00
|
|
|
# 3 total retries
|
|
|
|
StartLimitIntervalSec = 0;
|
|
|
|
StartLimitBurst = 3;
|
2023-08-22 15:48:29 -06:00
|
|
|
};
|
2023-08-22 18:00:31 -06:00
|
|
|
|
2023-08-22 15:48:29 -06:00
|
|
|
Install.WantedBy = [ "default.target" ];
|
|
|
|
Service = {
|
|
|
|
Type = "oneshot";
|
2023-08-22 18:07:27 -06:00
|
|
|
RestartSec = 5;
|
|
|
|
Restart = "onfailure";
|
2023-08-22 18:00:31 -06:00
|
|
|
ExecStart =
|
|
|
|
let path = config.age.secrets.gpg-keys.path;
|
2023-08-22 19:14:08 -06:00
|
|
|
passphrasePath = config.age.secrets.gpg-passphrase.path;
|
|
|
|
in "${pkgs.gnupg}/bin/gpg --pinentry-mode loopback --passphrase-file ${passphrasePath} --import ${path}";
|
2023-08-22 15:48:29 -06:00
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|