about summary refs log tree commit diff
path: root/modules/gnupg.nix
blob: d1b1d8aaad28d8763b32c9b4bbe1100220057170 (plain) (blame)
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
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.nixfiles.modules.gnupg;
in
{
  options.nixfiles.modules.gnupg = {
    enable = lib.mkEnableOption "GnuPG";
    pinentry = lib.mkOption {
      description = "Name of a pinentry implementation.";
      type = lib.types.package;
      default = pkgs.pinentry-curses;
    };
  };

  config = lib.mkIf cfg.enable {
    hm = {
      programs.gpg = {
        enable = true;
        homedir = "${config.dirs.data}/gnupg";
        settings = {
          armor = true;
          keyid-format = "long";
          no-greeting = true;
          no-random-seed-file = true;
          with-fingerprint = false;
          with-keygrip = false;
        };
      };

      services.gpg-agent = {
        enable = true;
        pinentryPackage = cfg.pinentry;
      };
    };
  };
}

Consider giving Nix/NixOS a try! <3