mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 06:59:45 +01:00
gpg-agent: remove unnecessary IFD
Make `gpgconf` only perform an import from derivation when the GPG `homedir` is set to a non-default value, which probably isn't the case for most users.
This commit is contained in:
parent
562449b503
commit
371576cdc2
1 changed files with 8 additions and 11 deletions
|
@ -20,22 +20,19 @@ let
|
||||||
# we cannot use `gpgconf` directly because it heavily depends on system
|
# we cannot use `gpgconf` directly because it heavily depends on system
|
||||||
# state, but we need the values at build time. original:
|
# state, but we need the values at build time. original:
|
||||||
# https://github.com/gpg/gnupg/blob/c6702d77d936b3e9d91b34d8fdee9599ab94ee1b/common/homedir.c#L672-L681
|
# https://github.com/gpg/gnupg/blob/c6702d77d936b3e9d91b34d8fdee9599ab94ee1b/common/homedir.c#L672-L681
|
||||||
gpgconf = dir: let
|
gpgconf = dir:
|
||||||
f = pkgs.runCommand dir {} ''
|
if homedir == options.programs.gpg.homedir.default then
|
||||||
PATH=${pkgs.coreutils}/bin:${pkgs.xxd}/bin:$PATH
|
"%t/gnupg/${dir}"
|
||||||
|
else
|
||||||
|
builtins.readFile (pkgs.runCommand dir {} ''
|
||||||
|
PATH=${pkgs.xxd}/bin:$PATH
|
||||||
|
|
||||||
if [[ ${homedir} = ${options.programs.gpg.homedir.default} ]]
|
|
||||||
then
|
|
||||||
echo -n "%t/gnupg/${dir}" > $out
|
|
||||||
else
|
|
||||||
hash=$(echo -n ${homedir} | sha1sum -b | xxd -r -p | base32 | \
|
hash=$(echo -n ${homedir} | sha1sum -b | xxd -r -p | base32 | \
|
||||||
cut -c -24 | tr '[:upper:]' '[:lower:]' | \
|
cut -c -24 | tr '[:upper:]' '[:lower:]' | \
|
||||||
tr abcdefghijklmnopqrstuvwxyz234567 \
|
tr abcdefghijklmnopqrstuvwxyz234567 \
|
||||||
ybndrfg8ejkmcpqxot1uwisza345h769)
|
ybndrfg8ejkmcpqxot1uwisza345h769)
|
||||||
echo -n "%t/gnupg/d.$hash/${dir}" > $out
|
echo -n "%t/gnupg/d.$hash/${dir}" > "$out"
|
||||||
fi
|
'');
|
||||||
'';
|
|
||||||
in "${builtins.readFile f}";
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue