summary refs log tree commit diff
path: root/nixos/modules/programs/gnupg.nix
diff options
context:
space:
mode:
authorBastian Köcher <git@kchr.de>2019-03-17 09:49:50 +0100
committerBastian Köcher <git@kchr.de>2019-04-05 08:49:53 +0200
commitc0deb007fcf1e898203ca8a51b8d6e6bf66e71de (patch)
tree224a84cf8ebaa3f25e9266109733039a5b6456a2 /nixos/modules/programs/gnupg.nix
parent9b3da9ef64f066c0bcf42f495a3d81b9e4dfa06e (diff)
downloadnixpkgs-c0deb007fcf1e898203ca8a51b8d6e6bf66e71de.tar
nixpkgs-c0deb007fcf1e898203ca8a51b8d6e6bf66e71de.tar.gz
nixpkgs-c0deb007fcf1e898203ca8a51b8d6e6bf66e71de.tar.bz2
nixpkgs-c0deb007fcf1e898203ca8a51b8d6e6bf66e71de.tar.lz
nixpkgs-c0deb007fcf1e898203ca8a51b8d6e6bf66e71de.tar.xz
nixpkgs-c0deb007fcf1e898203ca8a51b8d6e6bf66e71de.tar.zst
nixpkgs-c0deb007fcf1e898203ca8a51b8d6e6bf66e71de.zip
programs.gnupg: Support setting the gnupg package
Diffstat (limited to 'nixos/modules/programs/gnupg.nix')
-rw-r--r--nixos/modules/programs/gnupg.nix15
1 files changed, 12 insertions, 3 deletions
diff --git a/nixos/modules/programs/gnupg.nix b/nixos/modules/programs/gnupg.nix
index 22521280e93..9618d61a1f5 100644
--- a/nixos/modules/programs/gnupg.nix
+++ b/nixos/modules/programs/gnupg.nix
@@ -11,6 +11,15 @@ in
 {
 
   options.programs.gnupg = {
+    package = mkOption {
+      type = types.package;
+      default = pkgs.gnupg;
+      defaultText = "pkgs.gnupg";
+      description = ''
+        The gpg package that should be used.
+      '';
+    };
+
     agent.enable = mkOption {
       type = types.bool;
       default = false;
@@ -75,7 +84,7 @@ in
       wantedBy = [ "sockets.target" ];
     };
 
-    systemd.packages = [ pkgs.gnupg ];
+    systemd.packages = [ cfg.package ];
 
     environment.interactiveShellInit = ''
       # Bind gpg-agent to this TTY if gpg commands are used.
@@ -84,12 +93,12 @@ in
     '' + (optionalString cfg.agent.enableSSHSupport ''
       # SSH agent protocol doesn't support changing TTYs, so bind the agent
       # to every new TTY.
-      ${pkgs.gnupg}/bin/gpg-connect-agent --quiet updatestartuptty /bye > /dev/null
+      ${cfg.package}/bin/gpg-connect-agent --quiet updatestartuptty /bye > /dev/null
     '');
 
     environment.extraInit = mkIf cfg.agent.enableSSHSupport ''
       if [ -z "$SSH_AUTH_SOCK" ]; then
-        export SSH_AUTH_SOCK=$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket)
+        export SSH_AUTH_SOCK=$(${cfg.package}/bin/gpgconf --list-dirs agent-ssh-socket)
       fi
     '';