depot/third_party/nixpkgs/pkgs/tools/security/gnupg/1compat.nix
Default email 8ac5e011d6 Project import generated by Copybara.
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
2020-04-24 19:36:52 -04:00

30 lines
874 B
Nix

{ stdenv, gnupg, coreutils, writeScript }:
stdenv.mkDerivation {
name = "gnupg1compat-${gnupg.version}";
builder = writeScript "gnupg1compat-builder" ''
PATH=${coreutils}/bin
# First symlink all top-level dirs
mkdir -p $out
ln -s "${gnupg}/"* $out
# Replace bin with directory and symlink it contents
rm $out/bin
mkdir -p $out/bin
ln -s "${gnupg}/bin/"* $out/bin
# Add symlinks for any executables that end in 2 and lack any non-*2 version
for f in $out/bin/*2; do
[[ -x $f ]] || continue # ignore failed globs and non-executable files
[[ -e ''${f%2} ]] && continue # ignore commands that already have non-*2 versions
ln -s -- "''${f##*/}" "''${f%2}"
done
'';
meta = gnupg.meta // {
description = gnupg.meta.description +
" with symbolic links for gpg and gpgv";
priority = -1;
};
}