mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 05:03:09 +00:00
gnupg/gpg-agent: gnupg package is configurable (#1949)
This commit is contained in:
parent
865e404826
commit
d437baa41c
2 changed files with 15 additions and 6 deletions
|
@ -21,6 +21,14 @@ in
|
||||||
options.programs.gpg = {
|
options.programs.gpg = {
|
||||||
enable = mkEnableOption "GnuPG";
|
enable = mkEnableOption "GnuPG";
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = pkgs.gnupg;
|
||||||
|
defaultText = literalExample "pkgs.gnupg";
|
||||||
|
example = literalExample "pkgs.gnupg23";
|
||||||
|
description = "The Gnupg package to use (also used the gpg-agent service).";
|
||||||
|
};
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = types.attrsOf (types.either primitiveType (types.listOf types.str));
|
type = types.attrsOf (types.either primitiveType (types.listOf types.str));
|
||||||
example = literalExample ''
|
example = literalExample ''
|
||||||
|
@ -67,7 +75,7 @@ in
|
||||||
use-agent = mkDefault true;
|
use-agent = mkDefault true;
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages = [ pkgs.gnupg ];
|
home.packages = [ cfg.package ];
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
GNUPGHOME = cfg.homedir;
|
GNUPGHOME = cfg.homedir;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,6 +5,7 @@ with lib;
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.services.gpg-agent;
|
cfg = config.services.gpg-agent;
|
||||||
|
gpgPkg = config.programs.gpg.package;
|
||||||
|
|
||||||
homedir = config.programs.gpg.homedir;
|
homedir = config.programs.gpg.homedir;
|
||||||
|
|
||||||
|
@ -13,7 +14,7 @@ let
|
||||||
export GPG_TTY
|
export GPG_TTY
|
||||||
''
|
''
|
||||||
+ optionalString cfg.enableSshSupport
|
+ optionalString cfg.enableSshSupport
|
||||||
"${pkgs.gnupg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null";
|
"${gpgPkg}/bin/gpg-connect-agent updatestartuptty /bye > /dev/null";
|
||||||
|
|
||||||
# mimic `gpgconf` output for use in `systemd` unit definitions.
|
# mimic `gpgconf` output for use in `systemd` unit definitions.
|
||||||
# we cannot use `gpgconf` directly because it heavily depends on system
|
# we cannot use `gpgconf` directly because it heavily depends on system
|
||||||
|
@ -204,7 +205,7 @@ in
|
||||||
|
|
||||||
home.sessionVariables =
|
home.sessionVariables =
|
||||||
optionalAttrs cfg.enableSshSupport {
|
optionalAttrs cfg.enableSshSupport {
|
||||||
SSH_AUTH_SOCK = "$(${pkgs.gnupg}/bin/gpgconf --list-dirs agent-ssh-socket)";
|
SSH_AUTH_SOCK = "$(${gpgPkg}/bin/gpgconf --list-dirs agent-ssh-socket)";
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.bash.initExtra = gpgInitStr;
|
programs.bash.initExtra = gpgInitStr;
|
||||||
|
@ -222,7 +223,7 @@ in
|
||||||
# The systemd units below are direct translations of the
|
# The systemd units below are direct translations of the
|
||||||
# descriptions in the
|
# descriptions in the
|
||||||
#
|
#
|
||||||
# ${pkgs.gnupg}/share/doc/gnupg/examples/systemd-user
|
# ${gpgPkg}/share/doc/gnupg/examples/systemd-user
|
||||||
#
|
#
|
||||||
# directory.
|
# directory.
|
||||||
{
|
{
|
||||||
|
@ -237,9 +238,9 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
Service = {
|
Service = {
|
||||||
ExecStart = "${pkgs.gnupg}/bin/gpg-agent --supervised"
|
ExecStart = "${gpgPkg}/bin/gpg-agent --supervised"
|
||||||
+ optionalString cfg.verbose " --verbose";
|
+ optionalString cfg.verbose " --verbose";
|
||||||
ExecReload = "${pkgs.gnupg}/bin/gpgconf --reload gpg-agent";
|
ExecReload = "${gpgPkg}/bin/gpgconf --reload gpg-agent";
|
||||||
Environment = "GNUPGHOME=${homedir}";
|
Environment = "GNUPGHOME=${homedir}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue