1 { pkgs, lib, config, options, ... }:
5 home.activation.gnupg = lib.hm.dag.entryAfter ["writeBoundary"] ''
6 install -d -m700 ${lib.escapeShellArg config.programs.gpg.homedir}
10 enableSshSupport = true;
11 enableExtraSocket = true;
12 pinentryFlavor = if config.host.desktop then "gtk2" else "curses";
14 programs.gpg.settings = {
15 #auto-key-locate = "keyserver";
16 auto-key-locate = false;
17 cert-digest-algo = "SHA512";
19 default-keyring = false;
20 default-preference-list = "SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 TWOFISH BZIP2 ZLIB ZIP Uncompressed";
22 fixed-list-mode = true;
23 keyid-format = "0xlong";
24 keyserver-options = "no-honor-keyserver-url";
25 personal-cipher-preferences = "AES256 AES CAST5";
26 personal-digest-preferences = "SHA512";
28 s2k-cipher-algo = "AES256";
30 s2k-digest-algo = "SHA512";
32 tofu-default-policy = "unknown";
33 trust-model = "tofu+pgp";
34 #with-fingerprint = [ true true ];
38 home.file."${config.programs.gpg.homedir}/dirmngr.conf".text = ''
40 hkp-cacert ${gnupg/keyserver.pem}
41 keyserver hkps://keys.mayfirst.org
46 } // lib.optionalAttrs (options ? "nixpkgs") {
47 nixpkgs.overlays = [ (self: super: {
48 # Avoid rebuilding graphical dependencies
49 # when using Nixpkgs PRs rebuilding them.
50 # See https://github.com/NixOS/nixpkgs/issues/96306#issuecomment-722140002
51 pinentry = super.pinentry.override {
52 enabledFlavors = [ "curses" "tty" ] ++ lib.optional config.host.desktop "gtk2";