kore / home / features / cli / gpg.nix32 lines · 737B · raw
1{ pkgs, config, osConfig, lib, ... }:
2
3let
4 identity = osConfig.kore.identities.${config.home.username};
5in {
6 services.gpg-agent = {
7 enable = true;
8 enableSshSupport = true;
9
10 pinentry.package = pkgs.pinentry-curses;
11 };
12
13 programs = {
14 gpg = {
15 enable = true;
16 settings.trust-model = "tofu+pgp";
17 scdaemonSettings.disable-ccid = true;
18
19 publicKeys = lib.optional (identity.gpgKey != null) {
20 source = identity.gpgKey;
21 trust = "ultimate";
22 };
23 };
24
25 bash.initExtra = ''
26 export GPG_TTY="$(tty)"
27 export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
28 gpgconf --launch gpg-agent
29 gpg-connect-agent UPDATESTARTUPTTY /bye > /dev/null
30 '';
31 };
32}