feat(home): GnuPG

This commit is contained in:
punkfairie 2024-11-16 17:26:48 -08:00
parent 4f63d4d24f
commit 0b1015ebe1
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696
3 changed files with 39 additions and 17 deletions

View file

@ -27,6 +27,7 @@ in
gh = enabled;
git = enabled;
glow = enabled;
gpg = enabled;
journalctl = enabled;
neo = enabled;
systemctl = enabled;

View file

@ -0,0 +1,38 @@
{
lib,
config,
namespace,
pkgs,
...
}:
let
inherit (lib) mkIf;
inherit (lib.${namespace}) mkEnableModule isDesktop;
cfg = config.${namespace}.programs.gpg;
in
{
options = mkEnableModule "programs.gpg";
config = mkIf cfg.enable {
# home-manager gpg-agent module doesn't seem to actually install the desired
# pinentry program, so we install it here.
home.packages = [
config.services.gpg-agent.pinentryPackage
];
programs.gpg = {
enable = true;
};
services.gpg-agent = rec {
enable = true;
pinentryPackage = if isDesktop then pkgs.pinentry-gtk2 else pkgs.pinentry-curses;
# Don't ask for the password very often.
defaultCacheTtl = 60480000;
maxCacheTtl = defaultCacheTtl;
};
};
}

View file

@ -1,17 +0,0 @@
{ pkgs, ... }:
{
programs.gpg = {
enable = true;
};
services.gpg-agent = rec {
enable = true;
# TODO: Set this to pinentry-curses on non-GUI systems.
pinentryPackage = pkgs.pinentry-gtk2;
# Don't ask for the password very often.
defaultCacheTtl = 60480000;
maxCacheTtl = defaultCacheTtl;
};
}