nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 stdenv,
3 gnupg,
4 coreutils,
5 writeScript,
6}:
7
8stdenv.mkDerivation {
9 pname = "gnupg1compat";
10 version = gnupg.version;
11
12 builder = writeScript "gnupg1compat-builder" ''
13 PATH=${coreutils}/bin
14 # First symlink all top-level dirs
15 mkdir -p $out
16 ln -s "${gnupg}/"* $out
17
18 # Replace bin with directory and symlink it contents
19 rm $out/bin
20 mkdir -p $out/bin
21 ln -s "${gnupg}/bin/"* $out/bin
22
23 # Add symlinks for any executables that end in 2 and lack any non-*2 version
24 for f in $out/bin/*2; do
25 [[ -x $f ]] || continue # ignore failed globs and non-executable files
26 [[ -e ''${f%2} ]] && continue # ignore commands that already have non-*2 versions
27 ln -s -- "''${f##*/}" "''${f%2}"
28 done
29 '';
30
31 meta = gnupg.meta // {
32 description = gnupg.meta.description + " with symbolic links for gpg and gpgv";
33 priority = -1;
34 };
35}