parallel-full: fix missing files and meta

Previously, this was not usable as a drop-in replacement for `parallel`
since it only included the one exe. This changes to additionally symlink
all files from $out as well as symlink all other outputs. So no files
are missing compared to `parallel`, while being efficiently symlinked.

Further, copy meta and version from the base package.
This commit is contained in:
Andrew Marshall 2023-11-08 05:22:37 -05:00
parent 63c3a29ca8
commit a52252c919

View file

@ -1,10 +1,18 @@
{ lib, runCommand, makeWrapper, parallel, perlPackages
{ lib, symlinkJoin, makeWrapper, parallel, perlPackages
, extraPerlPackages ? with perlPackages; [ DBI DBDPg DBDSQLite DBDCSV TextCSV ]
, willCite ? false }:
runCommand "parallel-full" { nativeBuildInputs = [ makeWrapper ]; } ''
mkdir -p $out/bin
makeWrapper ${parallel}/bin/parallel $out/bin/parallel \
--set PERL5LIB "${perlPackages.makeFullPerlPath extraPerlPackages}" \
${lib.optionalString willCite "--add-flags --will-cite"}
''
symlinkJoin {
name = "parallel-full";
inherit (parallel) outputs;
nativeBuildInputs = [ makeWrapper ];
paths = [ parallel ];
postBuild = ''
${lib.concatMapStringsSep "\n" (output: "ln -s --no-target-directory ${parallel.${output}} \$${output}") (lib.remove "out" parallel.outputs)}
rm $out/bin/parallel
makeWrapper ${parallel}/bin/parallel $out/bin/parallel \
--set PERL5LIB "${perlPackages.makeFullPerlPath extraPerlPackages}" \
${lib.optionalString willCite "--add-flags --will-cite"}
'';
}