diff options
Diffstat (limited to 'nixpkgs/pkgs/tools/security/gnupg/1compat.nix')
-rw-r--r-- | nixpkgs/pkgs/tools/security/gnupg/1compat.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/security/gnupg/1compat.nix b/nixpkgs/pkgs/tools/security/gnupg/1compat.nix new file mode 100644 index 000000000000..371a7ca67afd --- /dev/null +++ b/nixpkgs/pkgs/tools/security/gnupg/1compat.nix @@ -0,0 +1,30 @@ +{ 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; + }; +} |