{ lib, config, pkgs, ... }:
with lib;
let
  cfg = config.modules.application.gnupg;
in
{
  options.modules.application.gnupg = {
    enable = mkEnableOption "enable GnuPG and related utils";

    pass = mkOption {
      type = types.bool;
      default = true;
      description = "install password-store";
    };
  };
  config = mkIf cfg.enable {

  home.packages = with pkgs; [
    # pinentry-gnome
    pkgs.gcr
  ];

    programs.gpg = {
      enable = true;
      scdaemonSettings = {
        disable-ccid = true;
      };
    };

    services.gpg-agent = {
      enable = true;
      enableScDaemon = true;
      enableZshIntegration = true;
      pinentryPackage = pkgs.pinentry-gnome3;
    };

    programs.password-store = {
      enable = cfg.pass;
    };
  };
}
