Merge pull request #114297 from rnhmjoj/perl-with-packages

treewide: use perl.withPackages when possible
This commit is contained in:
Michele Guerini Rocco 2021-04-01 00:57:55 +02:00 committed by GitHub
commit 094710e3da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 86 additions and 141 deletions

View File

@ -556,10 +556,8 @@ in {
install -m 0700 -d /root install -m 0700 -d /root
install -m 0755 -d /home install -m 0755 -d /home
${pkgs.perl}/bin/perl -w \ ${pkgs.perl.withPackages (p: [ p.FileSlurp p.JSON ])}/bin/perl \
-I${pkgs.perlPackages.FileSlurp}/${pkgs.perl.libPrefix} \ -w ${./update-users-groups.pl} ${spec}
-I${pkgs.perlPackages.JSON}/${pkgs.perl.libPrefix} \
${./update-users-groups.pl} ${spec}
''; '';
# for backwards compatibility # for backwards compatibility

View File

@ -34,7 +34,7 @@ let
name = "nixos-generate-config"; name = "nixos-generate-config";
src = ./nixos-generate-config.pl; src = ./nixos-generate-config.pl;
path = lib.optionals (lib.elem "btrfs" config.boot.supportedFilesystems) [ pkgs.btrfs-progs ]; path = lib.optionals (lib.elem "btrfs" config.boot.supportedFilesystems) [ pkgs.btrfs-progs ];
perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/${pkgs.perl.libPrefix}"; perl = "${pkgs.perl.withPackages (p: [ p.FileSlurp ])}/bin/perl";
inherit (config.system.nixos-generate-config) configuration desktopConfiguration; inherit (config.system.nixos-generate-config) configuration desktopConfiguration;
xserverEnabled = config.services.xserver.enable; xserverEnabled = config.services.xserver.enable;
}; };

View File

@ -14,10 +14,8 @@ let
dir = "bin"; dir = "bin";
src = ./command-not-found.pl; src = ./command-not-found.pl;
isExecutable = true; isExecutable = true;
inherit (pkgs) perl;
inherit (cfg) dbPath; inherit (cfg) dbPath;
perlFlags = concatStrings (map (path: "-I ${path}/${pkgs.perl.libPrefix} ") perl = pkgs.perl.withPackages (p: [ p.DBDSQLite p.StringShellQuote ]);
[ pkgs.perlPackages.DBI pkgs.perlPackages.DBDSQLite pkgs.perlPackages.StringShellQuote ]);
}; };
in in

View File

@ -1,4 +1,4 @@
#! @perl@/bin/perl -w @perlFlags@ #! @perl@/bin/perl -w
use strict; use strict;
use DBI; use DBI;

View File

@ -1,4 +1,4 @@
#! @perl@ #! @perl@/bin/perl
use strict; use strict;
use warnings; use warnings;

View File

@ -113,8 +113,7 @@ let
configurationName = config.boot.loader.grub.configurationName; configurationName = config.boot.loader.grub.configurationName;
# Needed by switch-to-configuration. # Needed by switch-to-configuration.
perl = pkgs.perl.withPackages (p: with p; [ FileSlurp NetDBus XMLParser XMLTwig ]);
perl = "${pkgs.perl}/bin/perl " + (concatMapStringsSep " " (lib: "-I${lib}/${pkgs.perl.libPrefix}") (with pkgs.perlPackages; [ FileSlurp NetDBus XMLParser XMLTwig ]));
}; };
# Handle assertions and warnings # Handle assertions and warnings

View File

@ -728,13 +728,17 @@ in
utillinux = pkgs.util-linux; utillinux = pkgs.util-linux;
btrfsprogs = pkgs.btrfs-progs; btrfsprogs = pkgs.btrfs-progs;
}; };
perl = pkgs.perl.withPackages (p: with p; [
FileSlurp FileCopyRecursive
XMLLibXML XMLSAX XMLSAXBase
ListCompare JSON
]);
in pkgs.writeScript "install-grub.sh" ('' in pkgs.writeScript "install-grub.sh" (''
#!${pkgs.runtimeShell} #!${pkgs.runtimeShell}
set -e set -e
export PERL5LIB=${with pkgs.perlPackages; makePerlPath [ FileSlurp FileCopyRecursive XMLLibXML XMLSAX XMLSAXBase ListCompare JSON ]}
${optionalString cfg.enableCryptodisk "export GRUB_ENABLE_CRYPTODISK=y"} ${optionalString cfg.enableCryptodisk "export GRUB_ENABLE_CRYPTODISK=y"}
'' + flip concatMapStrings cfg.mirroredBoots (args: '' '' + flip concatMapStrings cfg.mirroredBoots (args: ''
${pkgs.perl}/bin/perl ${install-grub-pl} ${grubConfig args} $@ ${perl}/bin/perl ${install-grub-pl} ${grubConfig args} $@
'') + cfg.extraInstallCommands); '') + cfg.extraInstallCommands);
system.build.grub = grub; system.build.grub = grub;

View File

@ -154,7 +154,7 @@ in
'' ''
# Set up the statically computed bits of /etc. # Set up the statically computed bits of /etc.
echo "setting up /etc..." echo "setting up /etc..."
${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/${pkgs.perl.libPrefix} ${./setup-etc.pl} ${etc}/etc ${pkgs.perl.withPackages (p: [ p.FileSlurp ])}/bin/perl ${./setup-etc.pl} ${etc}/etc
''; '';
}; };

View File

@ -6,7 +6,7 @@ let
makeScript = name: service: pkgs.writeScript "${name}-runner" makeScript = name: service: pkgs.writeScript "${name}-runner"
'' ''
#! ${pkgs.perl}/bin/perl -w -I${pkgs.perlPackages.FileSlurp}/${pkgs.perl.libPrefix} #! ${pkgs.perl.withPackages (p: [ p.FileSlurp ])}/bin/perl -w
use File::Slurp; use File::Slurp;

View File

@ -1,6 +1,6 @@
{ lib, stdenv, fetchurl, makeWrapper { lib, stdenv, fetchurl, makeWrapper
, xorg, imlib2, libjpeg, libpng , xorg, imlib2, libjpeg, libpng
, curl, libexif, jpegexiforient, perlPackages , curl, libexif, jpegexiforient, perl
, enableAutoreload ? !stdenv.hostPlatform.isDarwin }: , enableAutoreload ? !stdenv.hostPlatform.isDarwin }:
with lib; with lib;
@ -31,14 +31,7 @@ stdenv.mkDerivation rec {
--add-flags '--theme=feh' --add-flags '--theme=feh'
''; '';
checkInputs = [ perlPackages.perl perlPackages.TestCommand ]; checkInputs = lib.singleton (perl.withPackages (p: [ p.TestCommand ]));
preCheck = ''
export PERL5LIB="${perlPackages.TestCommand}/${perlPackages.perl.libPrefix}"
'';
postCheck = ''
unset PERL5LIB
'';
doCheck = true; doCheck = true;
meta = { meta = {

View File

@ -257,18 +257,9 @@ rec {
# print "Howdy!\n" if true; # print "Howdy!\n" if true;
# '' # ''
writePerl = name: { libraries ? [] }: writePerl = name: { libraries ? [] }:
let makeScriptWriter {
perl-env = pkgs.buildEnv { interpreter = "${pkgs.perl.withPackages (p: libraries)}/bin/perl";
name = "perl-environment"; } name;
paths = libraries;
pathsToLink = [
"/${pkgs.perl.libPrefix}"
];
};
in
makeScriptWriter {
interpreter = "${pkgs.perl}/bin/perl -I ${perl-env}/${pkgs.perl.libPrefix}";
} name;
# writePerlBin takes the same arguments as writePerl but outputs a directory (like writeScriptBin) # writePerlBin takes the same arguments as writePerl but outputs a directory (like writeScriptBin)
writePerlBin = name: writePerlBin = name:

View File

@ -1,4 +1,4 @@
{lib, stdenv, fetchurl, perlPackages, librsvg}: {lib, stdenv, fetchurl, perl, librsvg}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "icon-naming-utils-0.8.90"; name = "icon-naming-utils-0.8.90";
@ -8,14 +8,7 @@ stdenv.mkDerivation rec {
sha256 = "071fj2jm5kydlz02ic5sylhmw6h2p3cgrm3gwdfabinqkqcv4jh4"; sha256 = "071fj2jm5kydlz02ic5sylhmw6h2p3cgrm3gwdfabinqkqcv4jh4";
}; };
buildInputs = [ librsvg ] ++ (with perlPackages; [ perl XMLSimple ]); buildInputs = [ librsvg (perl.withPackages (p: [ p.XMLSimple ])) ];
postInstall =
''
# Add XML::Simple to the runtime search path.
substituteInPlace $out/libexec/icon-name-mapping \
--replace '/bin/perl' '/bin/perl -I${perlPackages.XMLSimple}/${perlPackages.perl.libPrefix}'
'';
meta = with lib; { meta = with lib; {
homepage = "http://tango.freedesktop.org/Standard_Icon_Naming_Specification"; homepage = "http://tango.freedesktop.org/Standard_Icon_Naming_Specification";

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, pkg-config, bc, perl, perlPackages, pam, libXext, libXScrnSaver, libX11 { lib, stdenv, fetchurl, pkg-config, bc, perl, pam, libXext, libXScrnSaver, libX11
, libXrandr, libXmu, libXxf86vm, libXrender, libXxf86misc, libjpeg, libGLU, libGL, gtk2 , libXrandr, libXmu, libXxf86vm, libXrender, libXxf86misc, libjpeg, libGLU, libGL, gtk2
, libxml2, libglade, intltool, xorg, makeWrapper, gle, gdk-pixbuf, gdk-pixbuf-xlib , libxml2, libglade, intltool, xorg, makeWrapper, gle, gdk-pixbuf, gdk-pixbuf-xlib
, forceInstallAllHacks ? false , forceInstallAllHacks ? false
@ -38,11 +38,13 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
wrapProgram $out/bin/xscreensaver-text \ wrapProgram $out/bin/xscreensaver-text \
--prefix PATH : ${lib.makeBinPath [xorg.appres]} --prefix PATH : ${lib.makeBinPath [xorg.appres]}
wrapProgram $out/bin/xscreensaver-getimage-file \
--set PERL5LIB "$out/${perlPackages.perl.libPrefix}:${with perlPackages; makePerlPath [ substituteInPlace $out/bin/xscreensaver-getimage-file \
EncodeLocale HTTPDate HTTPMessage IOSocketSSL LWP LWPProtocolHttps --replace '${perl}' '${perl.withPackages (p: with p;
MozillaCA NetHTTP NetSSLeay TryTiny URI [ EncodeLocale HTTPDate HTTPMessage IOSocketSSL
]}" LWP LWPProtocolHttps MozillaCA NetHTTP
NetSSLeay TryTiny URI
])}'
'' ''
+ lib.optionalString forceInstallAllHacks '' + lib.optionalString forceInstallAllHacks ''
make -C hacks/glx dnalogo make -C hacks/glx dnalogo

View File

@ -136,10 +136,9 @@ let
wrapProgram $out/bin/$prog --prefix PYTHONPATH : "$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH" wrapProgram $out/bin/$prog --prefix PYTHONPATH : "$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
done done
substituteInPlace $out/bin/aa-notify --replace /usr/bin/notify-send ${libnotify}/bin/notify-send substituteInPlace $out/bin/aa-notify \
# aa-notify checks its name and does not work named ".aa-notify-wrapped" --replace /usr/bin/notify-send ${libnotify}/bin/notify-send \
mv $out/bin/aa-notify $out/bin/aa-notify-wrapped --replace /usr/bin/perl "${perl}/bin/perl -I ${libapparmor}/${perl.libPrefix}"
makeWrapper ${perl}/bin/perl $out/bin/aa-notify --set PERL5LIB ${libapparmor}/${perl.libPrefix} --add-flags $out/bin/aa-notify-wrapped
''; '';
inherit doCheck; inherit doCheck;

View File

@ -1,7 +1,6 @@
{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, docutils { lib, stdenv, fetchFromGitHub, cmake, pkg-config, docutils
, pandoc, ethtool, iproute, libnl, udev, python3, perl , pandoc, ethtool, iproute, libnl, udev, python3, perl
, makeWrapper }:
} :
let let
version = "34.0"; version = "34.0";
@ -17,7 +16,7 @@ in stdenv.mkDerivation {
sha256 = "sha256-2HFtj595sDmWqAewIMwKMaiSDVVWKdQA9l0QsPcw8qA="; sha256 = "sha256-2HFtj595sDmWqAewIMwKMaiSDVVWKdQA9l0QsPcw8qA=";
}; };
nativeBuildInputs = [ cmake pkg-config pandoc docutils makeWrapper ]; nativeBuildInputs = [ cmake pkg-config pandoc docutils ];
buildInputs = [ libnl ethtool iproute udev python3 perl ]; buildInputs = [ libnl ethtool iproute udev python3 perl ];
cmakeFlags = [ cmakeFlags = [
@ -39,7 +38,8 @@ in stdenv.mkDerivation {
postFixup = '' postFixup = ''
for pls in $out/bin/{ibfindnodesusing.pl,ibidsverify.pl}; do for pls in $out/bin/{ibfindnodesusing.pl,ibidsverify.pl}; do
echo "wrapping $pls" echo "wrapping $pls"
wrapProgram $pls --prefix PERL5LIB : "$out/${perl.libPrefix}" substituteInPlace $pls --replace \
"${perl}/bin/perl" "${perl}/bin/perl -I $out/${perl.libPrefix}"
done done
''; '';

View File

@ -1,4 +1,4 @@
{lib, stdenv, which, coreutils, perl, fetchurl, perlPackages, makeWrapper, diffutils , writeScriptBin, bzip2}: {lib, stdenv, which, coreutils, perl, fetchurl, makeWrapper, diffutils , writeScriptBin, bzip2}:
# quick usage: # quick usage:
# storeBackup.pl --sourceDir /home/user --backupDir /tmp/my_backup_destination # storeBackup.pl --sourceDir /home/user --backupDir /tmp/my_backup_destination
@ -37,12 +37,10 @@ stdenv.mkDerivation rec {
find $out -name "*.pl" | xargs sed -i \ find $out -name "*.pl" | xargs sed -i \
-e 's@/bin/pwd@${coreutils}/bin/pwd@' \ -e 's@/bin/pwd@${coreutils}/bin/pwd@' \
-e 's@/bin/sync@${coreutils}/bin/sync@' \ -e 's@/bin/sync@${coreutils}/bin/sync@' \
-e '1 s@/usr/bin/env perl@${perl}/bin/perl@' -e '1 s@/usr/bin/env perl@${perl.withPackages (p: [ p.DBFile ])}/bin/perl@'
for p in $out/bin/* for p in $out/bin/*
do wrapProgram "$p" \ do wrapProgram "$p" --prefix PATH ":" "${lib.makeBinPath [ which bzip2 ]}"
--prefix PERL5LIB ":" "${perlPackages.DBFile}/${perlPackages.perl.libPrefix}" \
--prefix PATH ":" "${lib.makeBinPath [ which bzip2 ]}"
done done
patchShebangs $out patchShebangs $out

View File

@ -21,6 +21,11 @@ let
propagatedBuildInputs = [ perlPackages.IOPipely Mojolicious-8-35 ]; propagatedBuildInputs = [ perlPackages.IOPipely Mojolicious-8-35 ];
}; };
perl' = perl.withPackages (p:
[ MojoIOLoopForkCall-0-20
p.TAPParserSourceHandlerpgTAP
]);
version = "0.20.0"; version = "0.20.0";
checksum = "15lb5qwksa508m9bj6d3n4rrjpakfaas9qxspg408bcqfp7pqjw3"; checksum = "15lb5qwksa508m9bj6d3n4rrjpakfaas9qxspg408bcqfp7pqjw3";
in in
@ -35,7 +40,7 @@ stdenv.mkDerivation {
sha256 = checksum; sha256 = checksum;
}; };
buildInputs = [ wget perl MojoIOLoopForkCall-0-20 perlPackages.TAPParserSourceHandlerpgTAP ]; buildInputs = [ wget perl' ];
nativeBuildInputs = [ autoconf automake autoreconfHook ]; nativeBuildInputs = [ autoconf automake autoreconfHook ];
@ -53,30 +58,6 @@ stdenv.mkDerivation {
automake automake
''; '';
postInstall = ''
substituteInPlace $out/bin/znapzend --replace "${perl}/bin/perl" \
"${perl}/bin/perl \
-I${Mojolicious-8-35}/${perl.libPrefix} \
-I${perlPackages.TAPParserSourceHandlerpgTAP}/${perl.libPrefix} \
-I${MojoIOLoopForkCall-0-20}/${perl.libPrefix} \
-I${perlPackages.IOPipely}/${perl.libPrefix} \
"
substituteInPlace $out/bin/znapzendzetup --replace "${perl}/bin/perl" \
"${perl}/bin/perl \
-I${Mojolicious-8-35}/${perl.libPrefix} \
-I${perlPackages.TAPParserSourceHandlerpgTAP}/${perl.libPrefix} \
-I${MojoIOLoopForkCall-0-20}/${perl.libPrefix} \
-I${perlPackages.IOPipely}/${perl.libPrefix} \
"
substituteInPlace $out/bin/znapzendztatz --replace "${perl}/bin/perl" \
"${perl}/bin/perl \
-I${Mojolicious-8-35}/${perl.libPrefix} \
-I${perlPackages.TAPParserSourceHandlerpgTAP}/${perl.libPrefix} \
-I${MojoIOLoopForkCall-0-20}/${perl.libPrefix} \
-I${perlPackages.IOPipely}/${perl.libPrefix} \
"
'';
meta = with lib; { meta = with lib; {
description = "High performance open source ZFS backup with mbuffer and ssh support"; description = "High performance open source ZFS backup with mbuffer and ssh support";
homepage = "http://www.znapzend.org"; homepage = "http://www.znapzend.org";

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, perlPackages, makeWrapper }: { lib, stdenv, fetchurl, perl, perlPackages }:
perlPackages.buildPerlPackage { perlPackages.buildPerlPackage {
pname = "File-Rename"; pname = "File-Rename";
@ -9,17 +9,15 @@ perlPackages.buildPerlPackage {
sha256 = "1cf6xx2hiy1xalp35fh8g73j67r0w0g66jpcbc6971x9jbm7bvjy"; sha256 = "1cf6xx2hiy1xalp35fh8g73j67r0w0g66jpcbc6971x9jbm7bvjy";
}; };
nativeBuildInputs = [ makeWrapper ];
# Fix an incorrect platform test that misidentifies Darwin as Windows # Fix an incorrect platform test that misidentifies Darwin as Windows
postPatch = '' postPatch = ''
substituteInPlace Makefile.PL \ substituteInPlace Makefile.PL \
--replace '/win/i' '/MSWin32/' --replace '/win/i' '/MSWin32/'
''; '';
postInstall = '' postFixup = ''
wrapProgram $out/bin/rename \ substituteInPlace $out/bin/rename \
--prefix PERL5LIB : $out/${perlPackages.perl.libPrefix} --replace "#!${perl}/bin/perl" "#!${perl}/bin/perl -I $out/${perl.libPrefix}"
''; '';
doCheck = !stdenv.isDarwin; doCheck = !stdenv.isDarwin;

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, fetchpatch, perl, perlPackages, finger_bsd, makeWrapper { lib, stdenv, fetchurl, fetchpatch, perl, finger_bsd
, abook ? null , abook ? null
, gnupg ? null , gnupg ? null
, goobook ? null , goobook ? null
@ -8,9 +8,8 @@
let let
version = "0.48.1"; version = "0.48.1";
perl' = perl.withPackages (p: with p; [ ConvertASN1 perlldap AuthenSASL ]);
in in
with lib;
with perlPackages;
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "lbdb"; pname = "lbdb";
inherit version; inherit version;
@ -19,20 +18,20 @@ stdenv.mkDerivation {
sha256 = "1gr5l2fr9qbdccga8bhsrpvz6jxigvfkdxrln9wyf2xpps5cdjxh"; sha256 = "1gr5l2fr9qbdccga8bhsrpvz6jxigvfkdxrln9wyf2xpps5cdjxh";
}; };
nativeBuildInputs = [ makeWrapper ]; buildInputs = [ goobook perl' ]
buildInputs = [ goobook perl ConvertASN1 perlldap AuthenSASL ] ++ lib.optional (!stdenv.isDarwin) finger_bsd
++ optional (!stdenv.isDarwin) finger_bsd ++ lib.optional (abook != null) abook
++ optional (abook != null) abook ++ lib.optional (gnupg != null) gnupg
++ optional (gnupg != null) gnupg ++ lib.optional (goobook != null) goobook
++ optional (goobook != null) goobook ++ lib.optional (khard != null) khard
++ optional (khard != null) khard ++ lib.optional (mu != null) mu;
++ optional (mu != null) mu;
configureFlags = [ ] configureFlags = [ ]
++ optional (abook != null) "--with-abook" ++ lib.optional (abook != null) "--with-abook"
++ optional (gnupg != null) "--with-gpg" ++ lib.optional (gnupg != null) "--with-gpg"
++ optional (goobook != null) "--with-goobook" ++ lib.optional (goobook != null) "--with-goobook"
++ optional (khard != null) "--with-khard" ++ lib.optional (khard != null) "--with-khard"
++ optional (mu != null) "--with-mu"; ++ lib.optional (mu != null) "--with-mu";
patches = [ ./add-methods-to-rc.patch patches = [ ./add-methods-to-rc.patch
# fix undefined exec_prefix. Remove with the next release # fix undefined exec_prefix. Remove with the next release
@ -42,12 +41,8 @@ stdenv.mkDerivation {
excludes = [ "debian/changelog" ]; excludes = [ "debian/changelog" ];
}) })
]; ];
postFixup = "wrapProgram $out/lib/mutt_ldap_query --prefix PERL5LIB : "
+ "${AuthenSASL}/${perl.libPrefix}"
+ ":${ConvertASN1}/${perl.libPrefix}"
+ ":${perlldap}/${perl.libPrefix}";
meta = { meta = with lib; {
homepage = "https://www.spinnaker.de/lbdb/"; homepage = "https://www.spinnaker.de/lbdb/";
license = licenses.gpl2; license = licenses.gpl2;
platforms = platforms.all; platforms = platforms.all;

View File

@ -1,7 +1,7 @@
{ fetchurl, lib, stdenv, gettext, perl, pkg-config, libxml2, pango, cairo, groff { fetchurl, lib, stdenv, gettext, perl, pkg-config, libxml2, pango, cairo, groff
, tcl-8_5, darwin }: , tcl-8_5, darwin }:
stdenv.mkDerivation rec { perl.pkgs.toPerlModule (stdenv.mkDerivation rec {
name = "rrdtool-1.7.2"; name = "rrdtool-1.7.2";
src = fetchurl { src = fetchurl {
@ -27,4 +27,4 @@ stdenv.mkDerivation rec {
platforms = platforms.linux ++ platforms.darwin; platforms = platforms.linux ++ platforms.darwin;
maintainers = with maintainers; [ pSub ]; maintainers = with maintainers; [ pSub ];
}; };
} })

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub, libxslt, libaio, systemd, perl, perlPackages { stdenv, lib, fetchFromGitHub, libxslt, libaio, systemd, perl
, docbook_xsl, coreutils, lsof, rdma-core, makeWrapper, sg3_utils, util-linux , docbook_xsl, coreutils, lsof, rdma-core, makeWrapper, sg3_utils, util-linux
}: }:
@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
substituteInPlace $out/sbin/tgt-admin \ substituteInPlace $out/sbin/tgt-admin \
--replace "#!/usr/bin/perl" "#! ${perl}/bin/perl -I${perlPackages.ConfigGeneral}/${perl.libPrefix}" --replace "#!/usr/bin/perl" "#! ${perl.withPackages (p: [ p.ConfigGeneral ])}/bin/perl"
wrapProgram $out/sbin/tgt-admin --prefix PATH : \ wrapProgram $out/sbin/tgt-admin --prefix PATH : \
${lib.makeBinPath [ lsof sg3_utils (placeholder "out") ]} ${lib.makeBinPath [ lsof sg3_utils (placeholder "out") ]}

View File

@ -56,7 +56,8 @@ stdenv.mkDerivation rec {
'' ''
for i in $out/bin/*; do for i in $out/bin/*; do
if head -n 1 $i | grep -q perl; then if head -n 1 $i | grep -q perl; then
wrapProgram $i --prefix PERL5LIB : $out/${perl.libPrefix} substituteInPlace $i --replace \
"${perl}/bin/perl" "${perl}/bin/perl -I $out/${perl.libPrefix}"
fi fi
done done

View File

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

View File

@ -11,7 +11,7 @@ let
common = common =
{ lib, stdenv, perl, curl, bzip2, sqlite, openssl ? null, xz { lib, stdenv, perl, curl, bzip2, sqlite, openssl ? null, xz
, bash, coreutils, util-linuxMinimal, gzip, gnutar , bash, coreutils, util-linuxMinimal, gzip, gnutar
, pkg-config, boehmgc, perlPackages, libsodium, brotli, boost, editline, nlohmann_json , pkg-config, boehmgc, libsodium, brotli, boost, editline, nlohmann_json
, autoreconfHook, autoconf-archive, bison, flex , autoreconfHook, autoconf-archive, bison, flex
, jq, libarchive, libcpuid , jq, libarchive, libcpuid
, lowdown, mdbook , lowdown, mdbook
@ -165,7 +165,7 @@ common =
}; };
passthru = { passthru = {
perl-bindings = stdenv.mkDerivation { perl-bindings = perl.pkgs.toPerlModule (stdenv.mkDerivation {
pname = "nix-perl"; pname = "nix-perl";
inherit version; inherit version;
@ -179,14 +179,14 @@ common =
[ perl pkg-config curl nix libsodium boost autoreconfHook autoconf-archive nlohmann_json ]; [ perl pkg-config curl nix libsodium boost autoreconfHook autoconf-archive nlohmann_json ];
configureFlags = configureFlags =
[ "--with-dbi=${perlPackages.DBI}/${perl.libPrefix}" [ "--with-dbi=${perl.pkgs.DBI}/${perl.libPrefix}"
"--with-dbd-sqlite=${perlPackages.DBDSQLite}/${perl.libPrefix}" "--with-dbd-sqlite=${perl.pkgs.DBDSQLite}/${perl.libPrefix}"
]; ];
preConfigure = "export NIX_STATE_DIR=$TMPDIR"; preConfigure = "export NIX_STATE_DIR=$TMPDIR";
preBuild = "unset NIX_INDENT_MAKE"; preBuild = "unset NIX_INDENT_MAKE";
}; });
}; };
}; };
in nix; in nix;

View File

@ -1,11 +1,11 @@
{ substituteAll, perlPackages, shadow, util-linux }: { substituteAll, perl, shadow, util-linux }:
substituteAll { substituteAll {
name = "nixos-container"; name = "nixos-container";
dir = "bin"; dir = "bin";
isExecutable = true; isExecutable = true;
src = ./nixos-container.pl; src = ./nixos-container.pl;
perl = "${perlPackages.perl}/bin/perl -I${perlPackages.FileSlurp}/${perlPackages.perl.libPrefix}"; perl = perl.withPackages (p: [ p.FileSlurp ]);
su = "${shadow.su}/bin/su"; su = "${shadow.su}/bin/su";
utillinux = util-linux; utillinux = util-linux;

View File

@ -1,4 +1,4 @@
#! @perl@ #! @perl@/bin/perl
use strict; use strict;
use POSIX; use POSIX;