nix-serve: $PERL5LIB -> perl.withPackages

This commit is contained in:
volth 2019-04-21 19:27:55 +00:00 committed by rnhmjoj
parent 61b7cab481
commit a480ba06d9
No known key found for this signature in database
GPG Key ID: BFBAF4C975F76450

@ -1,5 +1,5 @@
{ lib, stdenv, fetchFromGitHub,
bzip2, nix, perl, perlPackages,
bzip2, nix, perl, makeWrapper,
}:
with lib;
@ -18,21 +18,16 @@ stdenv.mkDerivation {
inherit rev sha256;
};
buildInputs = [ bzip2 perl nix nix.perl-bindings ]
++ (with perlPackages; [ DBI DBDSQLite Plack Starman ]);
nativeBuildInputs = [ makeWrapper ];
dontBuild = true;
installPhase = ''
mkdir -p $out/libexec/nix-serve
cp nix-serve.psgi $out/libexec/nix-serve/nix-serve.psgi
install -Dm0755 nix-serve.psgi $out/libexec/nix-serve/nix-serve.psgi
mkdir -p $out/bin
cat > $out/bin/nix-serve <<EOF
#! ${stdenv.shell}
PATH=${makeBinPath [ bzip2 nix ]}:\$PATH PERL5LIB=$PERL5LIB exec ${perlPackages.Starman}/bin/starman $out/libexec/nix-serve/nix-serve.psgi "\$@"
EOF
chmod +x $out/bin/nix-serve
makeWrapper ${perl.withPackages(p: [ p.DBDSQLite p.Plack p.Starman nix.perl-bindings ])}/bin/starman $out/bin/nix-serve \
--prefix PATH : "${makeBinPath [ bzip2 nix ]}" \
--add-flags $out/libexec/nix-serve/nix-serve.psgi
'';
meta = {