aboutsummaryrefslogtreecommitdiff
path: root/modules/gpg/default.nix
blob: 514f36f0abc3547ab4c6e36adc0c6b9190d8ccdd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ config, lib, pkgs, ... }:
let
  cfg = config.modules.gpg;

  inherit (lib) mkEnableOption mkOption mkIf types;
in
{
  options.modules.gpg = {
    enable = mkEnableOption "gpg";
  };

  config = mkIf cfg.enable {
    home.packages = with pkgs; [
      pinentry-qt
      # pinentry-dmenu
    ];
#    home.packages = with pkgs; [
#    pinentry-bemenu
#    (writeShellScriptBin "pinentry-menu" ''
#      exec ${pkgs.pinentry-bemenu}/bin/pinentry-bemenu -l 10 --nf "#4c4c4c" --nb "#0f0f0f" --af "#4c4c4c" --ab "#0f0f0f" --tb "#0f0f0f" --tf "#8aac8b" --sb "#0f0f0f" --sf "#8aac8b"--hb "#0f0f0f" --hf "#8aac8b" --fn "ComicShannsMono Nerd Font Mono 12" 
#    '')];
    services.gpg-agent = {
      enable = true;
      # TODO: look into forwarding and extra socket, seems useful
      enableBashIntegration = true;
      enableZshIntegration = true;
      # enableNushellIntegration = true;
      enableSshSupport = true;
      noAllowExternalCache = true;
      pinentryPackage = pkgs.pinentry-qt;
      # pinentryPackage = pkgs.pinentry-dmenu;
      #sshKeys = [ "36663E191B00E51513F90FA5CF2BCE8461C297CD" ];
    };

    home.file.".gnupg/pinentry-dmenu.conf" = {
      text = ''
        asterisk= "*";
        # prompt = "";
        font = "BerkeleyMonoPatched Nerd Font:size=13";
        prompt_fg = "#cacaca";
        prompt_bg = "#0d0d0d";
        normal_fg = "#4c4c4c";
        normal_bg = "#0d0d0d";
        select_fg = "#8aac8b";
        select_bg = "#0d0d0d";
        desc_fg = "#cacaca";
        desc_bg = "#0d0d0d";
        '';
    };
  };
}