aboutsummaryrefslogtreecommitdiff
path: root/modules/home-manager/gpg.nix
blob: 4c54efba3afd00ab43e643b0c765c454416d0c5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
  config,
  pkgs,
  lib,
  ...
}:

let
  pinentryPackage = if pkgs.stdenv.isDarwin then pkgs.pinentry_mac else pkgs.pinentry-curses;
  pinentryProgram = if pkgs.stdenv.isDarwin then "pinentry-mac" else "pinentry-curses";
in
{
  options.gpg.enable = lib.mkEnableOption "Setup gpg and agent";
  config = lib.mkIf config.gpg.enable {
    programs.gpg.enable = true;
    services.gpg-agent = {
      enable = true;
      pinentry.package = pinentryPackage;
      pinentry.program = pinentryProgram;
    };
  };
}