Skip to content

Commit 5391882

Browse files
committed
services.xserver.startGnuPGAgent: remove obsolete NixOS option
GnuPG 2.1.x changed the way the gpg-agent works, and that new approach no longer requires (or even supports) the "start everything as a child of the agent" scheme we've implemented in NixOS for older versions. To configure the gpg-agent for your X session, add the following code to ~/.xsession or some other appropriate place that's sourced at start-up: gpg-connect-agent /bye GPG_TTY=$(tty) export GPG_TTY If you want to use gpg-agent for SSH, too, also add the settings unset SSH_AGENT_PID export SSH_AUTH_SOCK="${HOME}/.gnupg/S.gpg-agent.ssh" and make sure that enable-ssh-support is included in your ~/.gnupg/gpg-agent.conf. The gpg-agent(1) man page has more details about this subject, i.e. in the "EXAMPLES" section.
1 parent 9c10ac9 commit 5391882

File tree

4 files changed

+2
-31
lines changed

4 files changed

+2
-31
lines changed

nixos/modules/config/gnu.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ with lib;
3737
services.openssh.enable = false;
3838
services.lshd.enable = true;
3939
programs.ssh.startAgent = false;
40-
services.xserver.startGnuPGAgent = true;
4140

4241
# TODO: GNU dico.
4342
# TODO: GNU Inetutils' inetd.

nixos/modules/rename.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ with lib;
111111
(mkRemovedOptionModule [ "services" "openvpn" "enable" ])
112112
(mkRemovedOptionModule [ "services" "printing" "cupsFilesConf" ])
113113
(mkRemovedOptionModule [ "services" "printing" "cupsdConf" ])
114+
(mkRemovedOptionModule [ "services" "xserver" "startGnuPGAgent" ])
114115

115116
];
116117
}

nixos/modules/services/x11/display-managers/default.nix

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,6 @@ let
4949
fi
5050
''}
5151
52-
${optionalString cfg.startGnuPGAgent ''
53-
if test -z "$SSH_AUTH_SOCK"; then
54-
# Restart this script as a child of the GnuPG agent.
55-
exec "${pkgs.gnupg}/bin/gpg-agent" \
56-
--enable-ssh-support --daemon \
57-
--pinentry-program "${pkgs.pinentry}/bin/pinentry-gtk-2" \
58-
--write-env-file "$HOME/.gpg-agent-info" \
59-
"$0" "$sessionType"
60-
fi
61-
''}
62-
6352
# Handle being called by kdm.
6453
if test "''${1:0:1}" = /; then eval exec "$1"; fi
6554

nixos/modules/services/x11/xserver.nix

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,6 @@ in
219219
'';
220220
};
221221

222-
startGnuPGAgent = mkOption {
223-
type = types.bool;
224-
default = false;
225-
description = ''
226-
Whether to start the GnuPG agent when you log in. The GnuPG agent
227-
remembers private keys for you so that you don't have to type in
228-
passphrases every time you make an SSH connection or sign/encrypt
229-
data. Use <command>ssh-add</command> to add a key to the agent.
230-
'';
231-
};
232-
233222
startDbusSession = mkOption {
234223
type = types.bool;
235224
default = true;
@@ -444,14 +433,7 @@ in
444433
in optional (driver != null) ({ inherit name; driverName = name; } // driver));
445434

446435
assertions =
447-
[ { assertion = !(config.programs.ssh.startAgent && cfg.startGnuPGAgent);
448-
message =
449-
''
450-
The OpenSSH agent and GnuPG agent cannot be started both. Please
451-
choose between ‘programs.ssh.startAgent’ and ‘services.xserver.startGnuPGAgent’.
452-
'';
453-
}
454-
{ assertion = config.security.polkit.enable;
436+
[ { assertion = config.security.polkit.enable;
455437
message = "X11 requires Polkit to be enabled (‘security.polkit.enable = true’).";
456438
}
457439
];

0 commit comments

Comments
 (0)