Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c27f57cf2588
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cddafbcc60f8
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Apr 5, 2019

  1. Copy the full SHA
    c0deb00 View commit details
  2. Merge pull request #57782 from bkchr/gnupg_program

    programs.gnupg: Support setting the gnupg program
    infinisil authored Apr 5, 2019
    Copy the full SHA
    cddafbc View commit details
Showing with 12 additions and 3 deletions.
  1. +12 −3 nixos/modules/programs/gnupg.nix
15 changes: 12 additions & 3 deletions nixos/modules/programs/gnupg.nix
Original file line number Diff line number Diff line change
@@ -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
'';