aboutsummaryrefslogblamecommitdiff
path: root/home/gpg/default.nix
blob: c3bcd50248642b5154efa451f06ebf33f230ca4c (plain) (tree)
1
2
3
4

                             

  





























                                                           
{ config, lib, ... }:
let cfg = config.my.home.gpg;
in
{
  options.my.home.gpg = with lib; {
    enable = mkEnableOption "gpg configuration";
    pinentry = mkOption {
      type = types.str;
      default = "tty";
      example = "gnome3";
      description = "Which pinentry interface to use";
    };
    defaultKey = mkOption {
      type = types.str;
      default = null;
      description = "Default GPG key";
    };
  };

  config = lib.mkIf cfg.enable {
    programs.gpg = {
      enable = true;
      settings = { default-key = cfg.defaultKey; };
    };
    services.gpg-agent = {
      enable = true;
      enableSshSupport = true; # One agent to rule them all
      pinentryFlavor = cfg.pinentry;
      extraConfig = ''
        allow-loopback-pinentry
      '';
    };
  };
}