diff --git a/doc/languages-frameworks/perl.xml b/doc/languages-frameworks/perl.xml
index dfb463b999126..149fcb275a095 100644
--- a/doc/languages-frameworks/perl.xml
+++ b/doc/languages-frameworks/perl.xml
@@ -177,5 +177,19 @@ you need it.
+Cross-compiling modules
+
+Nixpkgs has experimental support for cross-compiling Perl
+modules. In many cases, it will just work out of the box, even for
+modules with native extensions. Sometimes, however, the Makefile.PL
+for a module may (indirectly) import a native module. In that case,
+you will need to make a stub for that module that will satisfy the
+Makefile.PL and install it into
+lib/perl5/site_perl/cross_perl/${perl.version}.
+See the postInstall for DBI for
+an example.
+
+
+
diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix
index 6098b057a3709..3b01f4fed35a8 100644
--- a/nixos/doc/manual/default.nix
+++ b/nixos/doc/manual/default.nix
@@ -87,7 +87,7 @@ let
echo "for hints about the offending path)."
exit 1
fi
- ${libxslt.bin}/bin/xsltproc \
+ ${buildPackages.libxslt.bin}/bin/xsltproc \
--stringparam revision '${revision}' \
-o $out ${./options-to-docbook.xsl} $optionsXML
'';
@@ -139,7 +139,7 @@ let
manual-combined = runCommand "nixos-manual-combined"
{ inherit sources;
- buildInputs = [ libxml2 libxslt ];
+ nativeBuildInputs = [ buildPackages.libxml2 buildPackages.libxslt ];
meta.description = "The NixOS manual as plain docbook XML";
}
''
@@ -194,7 +194,7 @@ let
olinkDB = runCommand "manual-olinkdb"
{ inherit sources;
- buildInputs = [ libxml2 libxslt ];
+ nativeBuildInputs = [ buildPackages.libxml2 buildPackages.libxslt ];
}
''
xsltproc \
@@ -244,7 +244,7 @@ in rec {
# Generate the NixOS manual.
manual = runCommand "nixos-manual"
{ inherit sources;
- buildInputs = [ libxml2 libxslt ];
+ nativeBuildInputs = [ buildPackages.libxml2 buildPackages.libxslt ];
meta.description = "The NixOS manual in HTML format";
allowedReferences = ["out"];
}
@@ -302,7 +302,7 @@ in rec {
# Generate the NixOS manpages.
manpages = runCommand "nixos-manpages"
{ inherit sources;
- buildInputs = [ libxml2 libxslt ];
+ nativeBuildInputs = [ buildPackages.libxml2 buildPackages.libxslt ];
allowedReferences = ["out"];
}
''
diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix
index 46b22fc128540..6bf8c653e113a 100644
--- a/nixos/modules/config/i18n.nix
+++ b/nixos/modules/config/i18n.nix
@@ -10,7 +10,7 @@ with lib;
i18n = {
glibcLocales = mkOption {
type = types.path;
- default = pkgs.glibcLocales.override {
+ default = pkgs.buildPackages.glibcLocales.override {
allLocales = any (x: x == "all") config.i18n.supportedLocales;
locales = config.i18n.supportedLocales;
};
diff --git a/nixos/modules/config/no-x-libs.nix b/nixos/modules/config/no-x-libs.nix
index d8980944adc06..b9d5b2b903e79 100644
--- a/nixos/modules/config/no-x-libs.nix
+++ b/nixos/modules/config/no-x-libs.nix
@@ -36,6 +36,7 @@ with lib;
networkmanager-vpnc = pkgs.networkmanager-vpnc.override { withGnome = false; };
networkmanager-iodine = pkgs.networkmanager-iodine.override { withGnome = false; };
pinentry = pkgs.pinentry_ncurses;
+ gobjectIntrospection = pkgs.gobjectIntrospection.override { x11Support = false; };
};
};
}
diff --git a/nixos/modules/config/zram.nix b/nixos/modules/config/zram.nix
index ad41ad4f3d7c4..ae1b0a6c8e113 100644
--- a/nixos/modules/config/zram.nix
+++ b/nixos/modules/config/zram.nix
@@ -93,7 +93,7 @@ in
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
- ExecStop = "${pkgs.stdenv.shell} -c 'echo 1 > /sys/class/block/${dev}/reset'";
+ ExecStop = "${pkgs.runtimeShell} -c 'echo 1 > /sys/class/block/${dev}/reset'";
};
script = ''
set -u
diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix
index 50c085dd7ee24..eafc9869315a7 100644
--- a/nixos/modules/hardware/video/nvidia.nix
+++ b/nixos/modules/hardware/video/nvidia.nix
@@ -75,10 +75,10 @@ in
# Create /dev/nvidia-uvm when the nvidia-uvm module is loaded.
services.udev.extraRules =
''
- KERNEL=="nvidia", RUN+="${pkgs.stdenv.shell} -c 'mknod -m 666 /dev/nvidiactl c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 255'"
- KERNEL=="nvidia_modeset", RUN+="${pkgs.stdenv.shell} -c 'mknod -m 666 /dev/nvidia-modeset c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 254'"
- KERNEL=="card*", SUBSYSTEM=="drm", DRIVERS=="nvidia", RUN+="${pkgs.stdenv.shell} -c 'mknod -m 666 /dev/nvidia%n c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) %n'"
- KERNEL=="nvidia_uvm", RUN+="${pkgs.stdenv.shell} -c 'mknod -m 666 /dev/nvidia-uvm c $(grep nvidia-uvm /proc/devices | cut -d \ -f 1) 0'"
+ KERNEL=="nvidia", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidiactl c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 255'"
+ KERNEL=="nvidia_modeset", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidia-modeset c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 254'"
+ KERNEL=="card*", SUBSYSTEM=="drm", DRIVERS=="nvidia", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidia%n c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) %n'"
+ KERNEL=="nvidia_uvm", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidia-uvm c $(grep nvidia-uvm /proc/devices | cut -d \ -f 1) 0'"
'';
boot.blacklistedKernelModules = [ "nouveau" "nvidiafb" ];
diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix
index 11bd148d5deea..9217250eec290 100644
--- a/nixos/modules/misc/nixpkgs.nix
+++ b/nixos/modules/misc/nixpkgs.nix
@@ -61,7 +61,7 @@ in
inherit (config.nixpkgs) config overlays system;
}
'';
- default = import ../../.. { inherit (cfg) config overlays system; };
+ default = import ../../.. { inherit (cfg) config overlays system crossSystem; };
type = pkgsType;
example = literalExample ''import {}'';
description = ''
@@ -130,6 +130,18 @@ in
'';
};
+ crossSystem = mkOption {
+ type = types.nullOr types.attrs;
+ default = null;
+ description = ''
+ The description of the system we're cross-compiling to, or null
+ if this isn't a cross-compile. See the description of the
+ crossSystem argument in the nixpkgs manual.
+
+ Ignored when nixpkgs.pkgs
is set.
+ '';
+ };
+
system = mkOption {
type = types.str;
example = "i686-linux";
diff --git a/nixos/modules/programs/rootston.nix b/nixos/modules/programs/rootston.nix
index 1946b1db657b1..842d9e6cfb48f 100644
--- a/nixos/modules/programs/rootston.nix
+++ b/nixos/modules/programs/rootston.nix
@@ -6,7 +6,7 @@ let
cfg = config.programs.rootston;
rootstonWrapped = pkgs.writeScriptBin "rootston" ''
- #! ${pkgs.stdenv.shell}
+ #! ${pkgs.runtimeShell}
if [[ "$#" -ge 1 ]]; then
exec ${pkgs.rootston}/bin/rootston "$@"
else
diff --git a/nixos/modules/programs/ssh.nix b/nixos/modules/programs/ssh.nix
index 0935bf0cae714..36289080a82ac 100644
--- a/nixos/modules/programs/ssh.nix
+++ b/nixos/modules/programs/ssh.nix
@@ -13,7 +13,7 @@ let
askPasswordWrapper = pkgs.writeScript "ssh-askpass-wrapper"
''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
export DISPLAY="$(systemctl --user show-environment | ${pkgs.gnused}/bin/sed 's/^DISPLAY=\(.*\)/\1/; t; d')"
exec ${askPassword}
'';
diff --git a/nixos/modules/security/audit.nix b/nixos/modules/security/audit.nix
index 7ac21fd965071..2b22bdd9f0ae6 100644
--- a/nixos/modules/security/audit.nix
+++ b/nixos/modules/security/audit.nix
@@ -13,7 +13,7 @@ let
};
disableScript = pkgs.writeScript "audit-disable" ''
- #!${pkgs.stdenv.shell} -eu
+ #!${pkgs.runtimeShell} -eu
# Explicitly disable everything, as otherwise journald might start it.
auditctl -D
auditctl -e 0 -a task,never
@@ -23,7 +23,7 @@ let
# put in the store like this. At the same time, it doesn't feel like a huge deal and working
# around that is a pain so I'm leaving it like this for now.
startScript = pkgs.writeScript "audit-start" ''
- #!${pkgs.stdenv.shell} -eu
+ #!${pkgs.runtimeShell} -eu
# Clear out any rules we may start with
auditctl -D
@@ -43,7 +43,7 @@ let
'';
stopScript = pkgs.writeScript "audit-stop" ''
- #!${pkgs.stdenv.shell} -eu
+ #!${pkgs.runtimeShell} -eu
# Clear the rules
auditctl -D
diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix
index a57f14bb5ae1c..e0ec77a295947 100644
--- a/nixos/modules/security/sudo.nix
+++ b/nixos/modules/security/sudo.nix
@@ -215,7 +215,7 @@ in
{ src = pkgs.writeText "sudoers-in" cfg.configFile; }
# Make sure that the sudoers file is syntactically valid.
# (currently disabled - NIXOS-66)
- "${pkgs.sudo}/sbin/visudo -f $src -c && cp $src $out";
+ "${pkgs.buildPackages.sudo}/sbin/visudo -f $src -c && cp $src $out";
target = "sudoers";
mode = "0440";
};
diff --git a/nixos/modules/services/continuous-integration/buildkite-agent.nix b/nixos/modules/services/continuous-integration/buildkite-agent.nix
index 0a0c9f665d250..03af9a7859ec2 100644
--- a/nixos/modules/services/continuous-integration/buildkite-agent.nix
+++ b/nixos/modules/services/continuous-integration/buildkite-agent.nix
@@ -18,7 +18,7 @@ let
hooksDir = let
mkHookEntry = name: value: ''
cat > $out/${name} <= 2.0
# provides a /bin/sh by default.
- sh = pkgs.stdenv.shell;
+ sh = pkgs.runtimeShell;
binshDeps = pkgs.writeReferencesToFile sh;
in
pkgs.runCommand "nix.conf" { extraOptions = cfg.extraOptions; inherit binshDeps; } ''
diff --git a/nixos/modules/services/misc/nixos-manual.nix b/nixos/modules/services/misc/nixos-manual.nix
index 5d0f2abd13a90..b8253956d54f3 100644
--- a/nixos/modules/services/misc/nixos-manual.nix
+++ b/nixos/modules/services/misc/nixos-manual.nix
@@ -43,7 +43,7 @@ let
helpScript = pkgs.writeScriptBin "nixos-help"
''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
browser="$BROWSER"
if [ -z "$browser" ]; then
browser="$(type -P xdg-open || true)"
diff --git a/nixos/modules/services/misc/ssm-agent.nix b/nixos/modules/services/misc/ssm-agent.nix
index a57fbca86fb6a..e951a4c7ffa8a 100644
--- a/nixos/modules/services/misc/ssm-agent.nix
+++ b/nixos/modules/services/misc/ssm-agent.nix
@@ -8,7 +8,7 @@ let
# in nixpkgs doesn't seem to work properly on NixOS, so let's just fake the two fields SSM
# looks for. See https://github.com/aws/amazon-ssm-agent/issues/38 for upstream fix.
fake-lsb-release = pkgs.writeScriptBin "lsb_release" ''
- #!${pkgs.stdenv.shell}
+ #!${pkgs.runtimeShell}
case "$1" in
-i) echo "nixos";;
diff --git a/nixos/modules/services/monitoring/apcupsd.nix b/nixos/modules/services/monitoring/apcupsd.nix
index 9abd6e9ab6414..839116de6265b 100644
--- a/nixos/modules/services/monitoring/apcupsd.nix
+++ b/nixos/modules/services/monitoring/apcupsd.nix
@@ -38,7 +38,7 @@ let
];
shellCmdsForEventScript = eventname: commands: ''
- echo "#!${pkgs.stdenv.shell}" > "$out/${eventname}"
+ echo "#!${pkgs.runtimeShell}" > "$out/${eventname}"
echo '${commands}' >> "$out/${eventname}"
chmod a+x "$out/${eventname}"
'';
diff --git a/nixos/modules/services/monitoring/smartd.nix b/nixos/modules/services/monitoring/smartd.nix
index b8d9e58a5a823..fecae4ca1b362 100644
--- a/nixos/modules/services/monitoring/smartd.nix
+++ b/nixos/modules/services/monitoring/smartd.nix
@@ -14,7 +14,7 @@ let
nx = cfg.notifications.x11;
smartdNotify = pkgs.writeScript "smartd-notify.sh" ''
- #! ${pkgs.stdenv.shell}
+ #! ${pkgs.runtimeShell}
${optionalString nm.enable ''
{
${pkgs.coreutils}/bin/cat << EOF
diff --git a/nixos/modules/services/network-filesystems/xtreemfs.nix b/nixos/modules/services/network-filesystems/xtreemfs.nix
index 0c6714563d8a0..95d7641e8b53f 100644
--- a/nixos/modules/services/network-filesystems/xtreemfs.nix
+++ b/nixos/modules/services/network-filesystems/xtreemfs.nix
@@ -11,7 +11,7 @@ let
home = cfg.homeDir;
startupScript = class: configPath: pkgs.writeScript "xtreemfs-osd.sh" ''
- #! ${pkgs.stdenv.shell}
+ #! ${pkgs.runtimeShell}
JAVA_HOME="${pkgs.jdk}"
JAVADIR="${xtreemfs}/share/java"
JAVA_CALL="$JAVA_HOME/bin/java -ea -cp $JAVADIR/XtreemFS.jar:$JAVADIR/BabuDB.jar:$JAVADIR/Flease.jar:$JAVADIR/protobuf-java-2.5.0.jar:$JAVADIR/Foundation.jar:$JAVADIR/jdmkrt.jar:$JAVADIR/jdmktk.jar:$JAVADIR/commons-codec-1.3.jar"
diff --git a/nixos/modules/services/network-filesystems/yandex-disk.nix b/nixos/modules/services/network-filesystems/yandex-disk.nix
index 4de2066413313..44b0edf620185 100644
--- a/nixos/modules/services/network-filesystems/yandex-disk.nix
+++ b/nixos/modules/services/network-filesystems/yandex-disk.nix
@@ -99,10 +99,10 @@ in
exit 1
fi
- ${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${u} \
+ ${pkgs.su}/bin/su -s ${pkgs.runtimeShell} ${u} \
-c '${pkgs.yandex-disk}/bin/yandex-disk token -p ${cfg.password} ${cfg.username} ${dir}/token'
- ${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${u} \
+ ${pkgs.su}/bin/su -s ${pkgs.runtimeShell} ${u} \
-c '${pkgs.yandex-disk}/bin/yandex-disk start --no-daemon -a ${dir}/token -d ${cfg.directory} --exclude-dirs=${cfg.excludes}'
'';
diff --git a/nixos/modules/services/networking/amuled.nix b/nixos/modules/services/networking/amuled.nix
index fc7d56a24fa72..9898f164c5cf8 100644
--- a/nixos/modules/services/networking/amuled.nix
+++ b/nixos/modules/services/networking/amuled.nix
@@ -68,7 +68,7 @@ in
'';
script = ''
- ${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${user} \
+ ${pkgs.su}/bin/su -s ${pkgs.runtimeShell} ${user} \
-c 'HOME="${cfg.dataDir}" ${pkgs.amuleDaemon}/bin/amuled'
'';
};
diff --git a/nixos/modules/services/networking/firewall.nix b/nixos/modules/services/networking/firewall.nix
index bce48c8f65e54..20c0b0acf165c 100644
--- a/nixos/modules/services/networking/firewall.nix
+++ b/nixos/modules/services/networking/firewall.nix
@@ -54,7 +54,7 @@ let
'';
writeShScript = name: text: let dir = pkgs.writeScriptBin name ''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
${text}
''; in "${dir}/bin/${name}";
diff --git a/nixos/modules/services/networking/flashpolicyd.nix b/nixos/modules/services/networking/flashpolicyd.nix
index 5ba85178179bf..5b83ce131389b 100644
--- a/nixos/modules/services/networking/flashpolicyd.nix
+++ b/nixos/modules/services/networking/flashpolicyd.nix
@@ -22,7 +22,7 @@ let
flashpolicydWrapper = pkgs.writeScriptBin "flashpolicyd"
''
- #! ${pkgs.stdenv.shell}
+ #! ${pkgs.runtimeShell}
exec ${flashpolicyd}/Perl_xinetd/in.flashpolicyd.pl \
--file=${pkgs.writeText "flashpolixy.xml" cfg.policy} \
2> /dev/null
diff --git a/nixos/modules/services/networking/nftables.nix b/nixos/modules/services/networking/nftables.nix
index 56b942054140f..ad7c013a54491 100644
--- a/nixos/modules/services/networking/nftables.nix
+++ b/nixos/modules/services/networking/nftables.nix
@@ -116,7 +116,7 @@ in
include "${cfg.rulesetFile}"
'';
checkScript = pkgs.writeScript "nftables-check" ''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
if $(${pkgs.kmod}/bin/lsmod | grep -q ip_tables); then
echo "Unload ip_tables before using nftables!" 1>&2
exit 1
diff --git a/nixos/modules/services/networking/rdnssd.nix b/nixos/modules/services/networking/rdnssd.nix
index 95833d31e99d0..a102242eae715 100644
--- a/nixos/modules/services/networking/rdnssd.nix
+++ b/nixos/modules/services/networking/rdnssd.nix
@@ -6,7 +6,7 @@
with lib;
let
mergeHook = pkgs.writeScript "rdnssd-merge-hook" ''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
${pkgs.openresolv}/bin/resolvconf -u
'';
in
diff --git a/nixos/modules/services/security/torify.nix b/nixos/modules/services/security/torify.nix
index a29cb3f33dae6..08da726437ea8 100644
--- a/nixos/modules/services/security/torify.nix
+++ b/nixos/modules/services/security/torify.nix
@@ -7,7 +7,7 @@ let
torify = pkgs.writeTextFile {
name = "tsocks";
text = ''
- #!${pkgs.stdenv.shell}
+ #!${pkgs.runtimeShell}
TSOCKS_CONF_FILE=${pkgs.writeText "tsocks.conf" cfg.tsocks.config} LD_PRELOAD="${pkgs.tsocks}/lib/libtsocks.so $LD_PRELOAD" "$@"
'';
executable = true;
diff --git a/nixos/modules/services/security/torsocks.nix b/nixos/modules/services/security/torsocks.nix
index 1b5a05b21e77c..c60c745443bcf 100644
--- a/nixos/modules/services/security/torsocks.nix
+++ b/nixos/modules/services/security/torsocks.nix
@@ -23,7 +23,7 @@ let
wrapTorsocks = name: server: pkgs.writeTextFile {
name = name;
text = ''
- #!${pkgs.stdenv.shell}
+ #!${pkgs.runtimeShell}
TORSOCKS_CONF_FILE=${pkgs.writeText "torsocks.conf" (configFile server)} ${pkgs.torsocks}/bin/torsocks "$@"
'';
executable = true;
diff --git a/nixos/modules/services/torrent/transmission.nix b/nixos/modules/services/torrent/transmission.nix
index dd6b585b7e237..4911a64c95d04 100644
--- a/nixos/modules/services/torrent/transmission.nix
+++ b/nixos/modules/services/torrent/transmission.nix
@@ -90,7 +90,7 @@ in
# 1) Only the "transmission" user and group have access to torrents.
# 2) Optionally update/force specific fields into the configuration file.
serviceConfig.ExecStartPre = ''
- ${pkgs.stdenv.shell} -c "mkdir -p ${homeDir} ${settingsDir} ${fullSettings.download-dir} ${fullSettings.incomplete-dir} && chmod 770 ${homeDir} ${settingsDir} ${fullSettings.download-dir} ${fullSettings.incomplete-dir} && rm -f ${settingsDir}/settings.json && cp -f ${settingsFile} ${settingsDir}/settings.json"
+ ${pkgs.runtimeShell} -c "mkdir -p ${homeDir} ${settingsDir} ${fullSettings.download-dir} ${fullSettings.incomplete-dir} && chmod 770 ${homeDir} ${settingsDir} ${fullSettings.download-dir} ${fullSettings.incomplete-dir} && rm -f ${settingsDir}/settings.json && cp -f ${settingsFile} ${settingsDir}/settings.json"
'';
serviceConfig.ExecStart = "${pkgs.transmission}/bin/transmission-daemon -f --port ${toString config.services.transmission.port}";
serviceConfig.ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
diff --git a/nixos/modules/services/web-servers/apache-httpd/owncloud.nix b/nixos/modules/services/web-servers/apache-httpd/owncloud.nix
index cfddab2f50479..82b8bf3e30db5 100644
--- a/nixos/modules/services/web-servers/apache-httpd/owncloud.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/owncloud.nix
@@ -346,7 +346,7 @@ let
postgresql = serverInfo.fullConfig.services.postgresql.package;
setupDb = pkgs.writeScript "setup-owncloud-db" ''
- #!${pkgs.stdenv.shell}
+ #!${pkgs.runtimeShell}
PATH="${postgresql}/bin"
createuser --no-superuser --no-createdb --no-createrole "${config.dbUser}" || true
createdb "${config.dbName}" -O "${config.dbUser}" || true
diff --git a/nixos/modules/services/x11/desktop-managers/xfce.nix b/nixos/modules/services/x11/desktop-managers/xfce.nix
index 489bffbee917f..7dcc600d2664f 100644
--- a/nixos/modules/services/x11/desktop-managers/xfce.nix
+++ b/nixos/modules/services/x11/desktop-managers/xfce.nix
@@ -128,7 +128,7 @@ in
# Set GTK_DATA_PREFIX so that GTK+ can find the Xfce themes.
export GTK_DATA_PREFIX=${config.system.path}
- ${pkgs.stdenv.shell} ${pkgs.xfce.xinitrc} &
+ ${pkgs.runtimeShell} ${pkgs.xfce.xinitrc} &
waitPID=$!
'';
}];
diff --git a/nixos/modules/services/x11/display-managers/slim.nix b/nixos/modules/services/x11/display-managers/slim.nix
index 0c4dd1973b534..f645a5c2f0781 100644
--- a/nixos/modules/services/x11/display-managers/slim.nix
+++ b/nixos/modules/services/x11/display-managers/slim.nix
@@ -14,7 +14,7 @@ let
default_xserver ${dmcfg.xserverBin}
xserver_arguments ${toString dmcfg.xserverArgs}
sessiondir ${dmcfg.session.desktops}
- login_cmd exec ${pkgs.stdenv.shell} ${dmcfg.session.script} "%session"
+ login_cmd exec ${pkgs.runtimeShell} ${dmcfg.session.script} "%session"
halt_cmd ${config.systemd.package}/sbin/shutdown -h now
reboot_cmd ${config.systemd.package}/sbin/shutdown -r now
logfile /dev/stderr
diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix
index c2ac731d433d1..dd7929285cd22 100644
--- a/nixos/modules/system/activation/activation-script.nix
+++ b/nixos/modules/system/activation/activation-script.nix
@@ -61,7 +61,7 @@ in
apply = set: {
script =
''
- #! ${pkgs.stdenv.shell}
+ #! ${pkgs.runtimeShell}
systemConfig=@out@
diff --git a/nixos/modules/system/boot/kexec.nix b/nixos/modules/system/boot/kexec.nix
index b7821f9509f12..14ebe66e63204 100644
--- a/nixos/modules/system/boot/kexec.nix
+++ b/nixos/modules/system/boot/kexec.nix
@@ -1,21 +1,22 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
{
- environment.systemPackages = [ pkgs.kexectools ];
+ config = lib.mkIf (pkgs.kexectools != null) {
+ environment.systemPackages = [ pkgs.kexectools ];
- systemd.services."prepare-kexec" =
- { description = "Preparation for kexec";
- wantedBy = [ "kexec.target" ];
- before = [ "systemd-kexec.service" ];
- unitConfig.DefaultDependencies = false;
- serviceConfig.Type = "oneshot";
- path = [ pkgs.kexectools ];
- script =
- ''
- p=$(readlink -f /nix/var/nix/profiles/system)
- if ! [ -d $p ]; then exit 1; fi
- exec kexec --load $p/kernel --initrd=$p/initrd --append="$(cat $p/kernel-params) init=$p/init"
- '';
- };
-
-}
\ No newline at end of file
+ systemd.services."prepare-kexec" =
+ { description = "Preparation for kexec";
+ wantedBy = [ "kexec.target" ];
+ before = [ "systemd-kexec.service" ];
+ unitConfig.DefaultDependencies = false;
+ serviceConfig.Type = "oneshot";
+ path = [ pkgs.kexectools ];
+ script =
+ ''
+ p=$(readlink -f /nix/var/nix/profiles/system)
+ if ! [ -d $p ]; then exit 1; fi
+ exec kexec --load $p/kernel --initrd=$p/initrd --append="$(cat $p/kernel-params) init=$p/init"
+ '';
+ };
+ };
+}
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix
index 0d83391de893f..3f5254fe1ca2c 100644
--- a/nixos/modules/system/boot/loader/grub/grub.nix
+++ b/nixos/modules/system/boot/loader/grub/grub.nix
@@ -40,7 +40,7 @@ let
{ splashImage = f cfg.splashImage;
grub = f grub;
grubTarget = f (grub.grubTarget or "");
- shell = "${pkgs.stdenv.shell}";
+ shell = "${pkgs.runtimeShell}";
fullName = (builtins.parseDrvName realGrub.name).name;
fullVersion = (builtins.parseDrvName realGrub.name).version;
grubEfi = f grubEfi;
@@ -536,7 +536,7 @@ in
btrfsprogs = pkgs.btrfs-progs;
};
in pkgs.writeScript "install-grub.sh" (''
- #!${pkgs.stdenv.shell}
+ #!${pkgs.runtimeShell}
set -e
export PERL5LIB=${makePerlPath (with pkgs.perlPackages; [ FileSlurp XMLLibXML XMLSAX ListCompare ])}
${optionalString cfg.enableCryptodisk "export GRUB_ENABLE_CRYPTODISK=y"}
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index df450be8c4014..55bb6d3449c5c 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -30,6 +30,50 @@ let
# mounting `/`, like `/` on a loopback).
fileSystems = filter utils.fsNeededForBoot config.system.build.fileSystems;
+ # A utility for enumerating the shared-library dependencies of a program
+ findLibs = pkgs.writeShellScriptBin "find-libs" ''
+ set -euo pipefail
+
+ declare -A seen
+ declare -a left
+
+ patchelf="${pkgs.buildPackages.patchelf}/bin/patchelf"
+
+ function add_needed {
+ rpath="$($patchelf --print-rpath $1)"
+ dir="$(dirname $1)"
+ for lib in $($patchelf --print-needed $1); do
+ left+=("$lib" "$rpath" "$dir")
+ done
+ }
+
+ add_needed $1
+
+ while [ ''${#left[@]} -ne 0 ]; do
+ next=''${left[0]}
+ rpath=''${left[1]}
+ ORIGIN=''${left[2]}
+ left=("''${left[@]:3}")
+ if [ -z ''${seen[$next]+x} ]; then
+ seen[$next]=1
+ IFS=: read -ra paths <<< $rpath
+ res=
+ for path in "''${paths[@]}"; do
+ path=$(eval "echo $path")
+ if [ -f "$path/$next" ]; then
+ res="$path/$next"
+ echo "$res"
+ add_needed "$res"
+ break
+ fi
+ done
+ if [ -z "$res" ]; then
+ echo "Couldn't satisfy dependency $next" >&2
+ exit 1
+ fi
+ fi
+ done
+ '';
# Some additional utilities needed in stage 1, like mount, lvm, fsck
# etc. We don't want to bring in all of those packages, so we just
@@ -37,7 +81,7 @@ let
# we just copy what we need from Glibc and use patchelf to make it
# work.
extraUtils = pkgs.runCommandCC "extra-utils"
- { buildInputs = [pkgs.nukeReferences];
+ { nativeBuildInputs = [pkgs.buildPackages.nukeReferences];
allowedReferences = [ "out" ]; # prevent accidents like glibc being included in the initrd
}
''
@@ -103,9 +147,7 @@ let
# Copy all of the needed libraries
find $out/bin $out/lib -type f | while read BIN; do
echo "Copying libs for executable $BIN"
- LDD="$(ldd $BIN)" || continue
- LIBS="$(echo "$LDD" | awk '{print $3}' | sed '/^$/d')"
- for LIB in $LIBS; do
+ for LIB in $(${findLibs}/bin/find-libs $BIN); do
TGT="$out/lib/$(basename $LIB)"
if [ ! -f "$TGT" ]; then
SRC="$(readlink -e $LIB)"
@@ -132,6 +174,7 @@ let
fi
done
+ if [ -z "${toString pkgs.stdenv.isCross}" ]; then
# Make sure that the patchelf'ed binaries still work.
echo "testing patched programs..."
$out/bin/ash -c 'echo hello world' | grep "hello world"
@@ -144,6 +187,7 @@ let
$out/bin/mdadm --version
${config.boot.initrd.extraUtilsCommandsTest}
+ fi
''; # */
@@ -245,7 +289,7 @@ let
{ src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf"; }
''
target=$out
- ${pkgs.perl}/bin/perl -0pe 's/## file: iwlwifi.conf(.+?)##/##/s;' $src > $out
+ ${pkgs.buildPackages.perl}/bin/perl -0pe 's/## file: iwlwifi.conf(.+?)##/##/s;' $src > $out
'';
symlink = "/etc/modprobe.d/ubuntu.conf";
}
diff --git a/nixos/modules/system/boot/stage-2.nix b/nixos/modules/system/boot/stage-2.nix
index 8db6d2d2f7347..78afbd8dbc12b 100644
--- a/nixos/modules/system/boot/stage-2.nix
+++ b/nixos/modules/system/boot/stage-2.nix
@@ -10,6 +10,7 @@ let
bootStage2 = pkgs.substituteAll {
src = ./stage-2-init.sh;
shellDebug = "${pkgs.bashInteractive}/bin/bash";
+ shell = "${pkgs.bash}/bin/bash";
isExecutable = true;
inherit (config.nix) readOnlyStore;
inherit (config.networking) useHostResolvConf;
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix
index aff46ea861a2f..92c9ee0c4691b 100644
--- a/nixos/modules/system/boot/systemd.nix
+++ b/nixos/modules/system/boot/systemd.nix
@@ -241,37 +241,37 @@ let
}
(mkIf (config.preStart != "")
{ serviceConfig.ExecStartPre = makeJobScript "${name}-pre-start" ''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
${config.preStart}
'';
})
(mkIf (config.script != "")
{ serviceConfig.ExecStart = makeJobScript "${name}-start" ''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
${config.script}
'' + " " + config.scriptArgs;
})
(mkIf (config.postStart != "")
{ serviceConfig.ExecStartPost = makeJobScript "${name}-post-start" ''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
${config.postStart}
'';
})
(mkIf (config.reload != "")
{ serviceConfig.ExecReload = makeJobScript "${name}-reload" ''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
${config.reload}
'';
})
(mkIf (config.preStop != "")
{ serviceConfig.ExecStop = makeJobScript "${name}-pre-stop" ''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
${config.preStop}
'';
})
(mkIf (config.postStop != "")
{ serviceConfig.ExecStopPost = makeJobScript "${name}-post-stop" ''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
${config.postStop}
'';
})
diff --git a/nixos/modules/tasks/kbd.nix b/nixos/modules/tasks/kbd.nix
index 7fb3cbc5c1bc1..fbe42b8e8f04d 100644
--- a/nixos/modules/tasks/kbd.nix
+++ b/nixos/modules/tasks/kbd.nix
@@ -13,7 +13,7 @@ let
isUnicode = hasSuffix "UTF-8" (toUpper config.i18n.defaultLocale);
optimizedKeymap = pkgs.runCommand "keymap" {
- nativeBuildInputs = [ pkgs.kbd ];
+ nativeBuildInputs = [ pkgs.buildPackages.kbd ];
LOADKEYS_KEYMAP_PATH = "${kbdEnv}/share/keymaps/**";
} ''
loadkeys -b ${optionalString isUnicode "-u"} "${config.i18n.consoleKeyMap}" > $out
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index 5036b701bd86d..9c781f2b23ce3 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -26,7 +26,7 @@ let
executable = true;
destination = "/bin/bridge-stp";
text = ''
- #!${pkgs.stdenv.shell} -e
+ #!${pkgs.runtimeShell} -e
export PATH="${pkgs.mstpd}/bin"
BRIDGES=(${concatStringsSep " " (attrNames rstpBridges)})
@@ -64,7 +64,7 @@ let
# udev script that configures a physical wlan device and adds virtual interfaces
wlanDeviceUdevScript = device: interfaceList: pkgs.writeScript "wlan-${device}-udev-script" ''
- #!${pkgs.stdenv.shell}
+ #!${pkgs.runtimeShell}
# Change the wireless phy device to a predictable name.
if [ -e "/sys/class/net/${device}/phy80211/name" ]; then
@@ -1158,7 +1158,7 @@ in
# The script creates the required, new WLAN interfaces interfaces and configures the
# existing, default interface.
curInterfaceScript = device: current: new: pkgs.writeScript "udev-run-script-wlan-interfaces-${device}.sh" ''
- #!${pkgs.stdenv.shell}
+ #!${pkgs.runtimeShell}
# Change the wireless phy device to a predictable name.
${pkgs.iw}/bin/iw phy `${pkgs.coreutils}/bin/cat /sys/class/net/$INTERFACE/phy80211/name` set name ${device}
@@ -1177,7 +1177,7 @@ in
# Udev script to execute for a new WLAN interface. The script configures the new WLAN interface.
newInterfaceScript = device: new: pkgs.writeScript "udev-run-script-wlan-interfaces-${new._iName}.sh" ''
- #!${pkgs.stdenv.shell}
+ #!${pkgs.runtimeShell}
# Configure the new interface
${pkgs.iw}/bin/iw dev ${new._iName} set type ${new.type}
${optionalString (new.type == "mesh" && new.meshID!=null) "${pkgs.iw}/bin/iw dev ${device} set meshid ${new.meshID}"}
diff --git a/nixos/modules/virtualisation/amazon-init.nix b/nixos/modules/virtualisation/amazon-init.nix
index a7362423eb467..8032b2c6d7ca4 100644
--- a/nixos/modules/virtualisation/amazon-init.nix
+++ b/nixos/modules/virtualisation/amazon-init.nix
@@ -2,7 +2,7 @@
let
script = ''
- #!${pkgs.stdenv.shell} -eu
+ #!${pkgs.runtimeShell} -eu
echo "attempting to fetch configuration from EC2 user data..."
diff --git a/nixos/modules/virtualisation/azure-agent.nix b/nixos/modules/virtualisation/azure-agent.nix
index 6817eb837a018..201d5f71ba34d 100644
--- a/nixos/modules/virtualisation/azure-agent.nix
+++ b/nixos/modules/virtualisation/azure-agent.nix
@@ -47,7 +47,7 @@ let
};
provisionedHook = pkgs.writeScript "provisioned-hook" ''
- #!${pkgs.stdenv.shell}
+ #!${pkgs.runtimeShell}
${config.systemd.package}/bin/systemctl start provisioned.target
'';
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index 4038454b2d2fc..e54a5fe7d40cd 100644
--- a/nixos/modules/virtualisation/containers.nix
+++ b/nixos/modules/virtualisation/containers.nix
@@ -33,7 +33,7 @@ let
in
pkgs.writeScript "container-init"
''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
# Initialise the container side of the veth pair.
if [ "$PRIVATE_NETWORK" = 1 ]; then
@@ -223,7 +223,7 @@ let
serviceDirectives = cfg: {
ExecReload = pkgs.writeScript "reload-container"
''
- #! ${pkgs.stdenv.shell} -e
+ #! ${pkgs.runtimeShell} -e
${pkgs.nixos-container}/bin/nixos-container run "$INSTANCE" -- \
bash --login -c "''${SYSTEM_PATH:-/nix/var/nix/profiles/system}/bin/switch-to-configuration test"
'';
diff --git a/nixos/modules/virtualisation/openvswitch.nix b/nixos/modules/virtualisation/openvswitch.nix
index 4218a3840fc1a..38b138e063263 100644
--- a/nixos/modules/virtualisation/openvswitch.nix
+++ b/nixos/modules/virtualisation/openvswitch.nix
@@ -169,7 +169,7 @@ in {
mkdir -p ${runDir}/ipsec/{etc/racoon,etc/init.d/,usr/sbin/}
ln -fs ${pkgs.ipsecTools}/bin/setkey ${runDir}/ipsec/usr/sbin/setkey
ln -fs ${pkgs.writeScript "racoon-restart" ''
- #!${pkgs.stdenv.shell}
+ #!${pkgs.runtimeShell}
/var/run/current-system/sw/bin/systemctl $1 racoon
''} ${runDir}/ipsec/etc/init.d/racoon
'';
diff --git a/nixos/modules/virtualisation/qemu-vm.nix b/nixos/modules/virtualisation/qemu-vm.nix
index 13d0eb7de5c2d..271a0a089824e 100644
--- a/nixos/modules/virtualisation/qemu-vm.nix
+++ b/nixos/modules/virtualisation/qemu-vm.nix
@@ -30,7 +30,7 @@ let
# Shell script to start the VM.
startVM =
''
- #! ${pkgs.stdenv.shell}
+ #! ${pkgs.runtimeShell}
NIX_DISK_IMAGE=$(readlink -f ''${NIX_DISK_IMAGE:-${config.virtualisation.diskImage}})
diff --git a/pkgs/build-support/kernel/modules-closure.nix b/pkgs/build-support/kernel/modules-closure.nix
index a527770adcd7b..d82e279799ba3 100644
--- a/pkgs/build-support/kernel/modules-closure.nix
+++ b/pkgs/build-support/kernel/modules-closure.nix
@@ -9,7 +9,7 @@
stdenvNoCC.mkDerivation {
name = kernel.name + "-shrunk";
builder = ./modules-closure.sh;
- buildInputs = [ nukeReferences kmod ];
+ nativeBuildInputs = [ nukeReferences kmod ];
inherit kernel firmware rootModules allowMissing;
allowedReferences = ["out"];
}
diff --git a/pkgs/data/misc/tzdata/default.nix b/pkgs/data/misc/tzdata/default.nix
index ada2ed997dad4..6c8fd6229a3fe 100644
--- a/pkgs/data/misc/tzdata/default.nix
+++ b/pkgs/data/misc/tzdata/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, buildPackages }:
stdenv.mkDerivation rec {
name = "tzdata-${version}";
@@ -28,8 +28,23 @@ stdenv.mkDerivation rec {
"MANDIR=$(man)/share/man"
"AWK=awk"
"CFLAGS=-DHAVE_LINK=0"
+ "cc=${stdenv.cc.targetPrefix}cc"
+ "AR=${stdenv.cc.targetPrefix}ar"
];
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+
+ installFlags = [ "ZIC=./zic-native" ];
+
+ preInstall = ''
+ mv zic.o zic.o.orig
+ mv zic zic.orig
+ make $makeFlags cc=cc AR=ar zic
+ mv zic zic-native
+ mv zic.o.orig zic.o
+ mv zic.orig zic
+ '';
+
postInstall =
''
rm $out/share/zoneinfo-posix
diff --git a/pkgs/development/interpreters/perl/MakeMaker-cross.patch b/pkgs/development/interpreters/perl/MakeMaker-cross.patch
new file mode 100644
index 0000000000000..40626c51f9bd1
--- /dev/null
+++ b/pkgs/development/interpreters/perl/MakeMaker-cross.patch
@@ -0,0 +1,17 @@
+diff -Naur a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm
+--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm 2017-06-30 17:03:20.000000000 -0400
++++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm 2018-02-28 10:06:37.031237946 -0500
+@@ -1267,7 +1267,12 @@
+ my $value = shift;
+ return $value if $UNDER_CORE;
+ my $tvalue = '';
+- require B;
++ eval {
++ require B;
++ };
++ if ($@) {
++ return $tvalue;
++ }
+ my $sv = B::svref_2object(\$value);
+ my $magic = ref($sv) eq 'B::PVMG' ? $sv->MAGIC : undef;
+ while ( $magic ) {
diff --git a/pkgs/development/interpreters/perl/default.nix b/pkgs/development/interpreters/perl/default.nix
index f7324fc6d01ab..0fd55bd8d71be 100644
--- a/pkgs/development/interpreters/perl/default.nix
+++ b/pkgs/development/interpreters/perl/default.nix
@@ -1,4 +1,6 @@
-{ lib, stdenv, fetchurlBoot, buildPackages, enableThreading ? stdenv ? glibc, fetchpatch }:
+{ lib, stdenv, fetchurlBoot, buildPackages
+, enableThreading ? stdenv ? glibc, fetchpatch, makeWrapper
+}:
with lib;
@@ -29,7 +31,8 @@ let
};
# TODO: Add a "dev" output containing the header files.
- outputs = [ "out" "man" "devdoc" ];
+ outputs = [ "out" "man" "devdoc" ] ++
+ stdenv.lib.optional crossCompiling "dev";
setOutputFlags = false;
patches =
@@ -45,7 +48,8 @@ let
})
++ optional stdenv.isSunOS ./ld-shared.patch
++ optional stdenv.isDarwin ./cpp-precomp.patch
- ++ optional (stdenv.isDarwin && versionAtLeast version "5.24") ./sw_vers.patch;
+ ++ optional (stdenv.isDarwin && versionAtLeast version "5.24") ./sw_vers.patch
+ ++ optional crossCompiling ./MakeMaker-cross.patch;
postPatch = ''
pwd="$(type -P pwd)"
@@ -117,6 +121,28 @@ let
if stdenv.cc.cc or null != null then stdenv.cc.cc else "/no-such-path"
}" /no-such-path \
--replace "$man" /no-such-path
+ '' + stdenv.lib.optionalString crossCompiling
+ ''
+ mkdir -p $dev/lib/perl5/cross_perl/${version}
+ for dir in cnf/{stub,cpan}; do
+ cp -r $dir/* $dev/lib/perl5/cross_perl/${version}
+ done
+
+ mkdir -p $dev/bin
+ install -m755 miniperl $dev/bin/perl
+
+ export runtimeArch="$(ls $out/lib/perl5/site_perl/${version})"
+ # wrapProgram should use a runtime-native SHELL by default, but
+ # it actually uses a buildtime-native one. If we ever fix that,
+ # we'll need to fix this to use a buildtime-native one.
+ #
+ # Adding the arch-specific directory is morally incorrect, as
+ # miniperl can't load the native modules there. However, it can
+ # (and sometimes needs to) load and run some of the pure perl
+ # code there, so we add it anyway. When needed, stubs can be put
+ # into $dev/lib/perl5/cross_perl/${version}.
+ wrapProgram $dev/bin/perl --prefix PERL5LIB : \
+ "$dev/lib/perl5/cross_perl/${version}:$out/lib/perl5/${version}:$out/lib/perl5/${version}/$runtimeArch"
''; # */
meta = {
@@ -139,7 +165,7 @@ let
sha256 = "1gh8w9m5if2s0lrx2x8f8grp74d1l6d46m8jglpjm5a1kf55j810";
};
- depsBuildBuild = [ buildPackages.stdenv.cc ];
+ depsBuildBuild = [ buildPackages.stdenv.cc makeWrapper ];
postUnpack = ''
unpackFile ${perl-cross-src}
@@ -150,6 +176,11 @@ let
'';
configurePlatforms = [ "build" "host" "target" ];
+
+ inherit version;
+
+ # TODO merge setup hooks
+ setupHook = ./setup-hook-cross.sh;
});
in rec {
perl = perl524;
diff --git a/pkgs/development/interpreters/perl/setup-hook-cross.sh b/pkgs/development/interpreters/perl/setup-hook-cross.sh
new file mode 100644
index 0000000000000..95aae0b2670fa
--- /dev/null
+++ b/pkgs/development/interpreters/perl/setup-hook-cross.sh
@@ -0,0 +1,12 @@
+addPerlLibPath () {
+ addToSearchPath PERL5LIB $1/lib/perl5/site_perl/@version@
+ addToSearchPath PERL5LIB $1/lib/perl5/site_perl/cross_perl/@version@
+ # Adding the arch-specific directory is morally incorrect, as
+ # miniperl can't load the native modules there. However, it can
+ # (and sometimes needs to) load and run some of the pure perl
+ # code there, so we add it anyway. When needed, stubs can be put
+ # into $1/lib/perl5/site_perl/cross_perl/@version@
+ addToSearchPath PERL5LIB $1/lib/perl5/site_perl/@version@/@runtimeArch@
+}
+
+addEnvHooks "$targetOffset" addPerlLibPath
diff --git a/pkgs/development/libraries/boost/1.66.nix b/pkgs/development/libraries/boost/1.66.nix
index 3fd9c16082482..02cf511a6fdff 100644
--- a/pkgs/development/libraries/boost/1.66.nix
+++ b/pkgs/development/libraries/boost/1.66.nix
@@ -1,4 +1,4 @@
-{ stdenv, callPackage, fetchurl, ... } @ args:
+{ stdenv, callPackage, fetchurl, hostPlatform, buildPlatform, ... } @ args:
callPackage ./generic.nix (args // rec {
version = "1.66_0";
@@ -9,4 +9,5 @@ callPackage ./generic.nix (args // rec {
sha256 = "5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9";
};
+ toolset = if stdenv.cc.isClang then "clang" else null;
})
diff --git a/pkgs/development/libraries/dbus/make-dbus-conf.nix b/pkgs/development/libraries/dbus/make-dbus-conf.nix
index 71da22ee37483..c3c41b74f0990 100644
--- a/pkgs/development/libraries/dbus/make-dbus-conf.nix
+++ b/pkgs/development/libraries/dbus/make-dbus-conf.nix
@@ -24,16 +24,17 @@ runCommand "dbus-1"
rewritePrefix="file://${dbus}/share/xml/dbus/"/>
'';
+ nativeBuildInputs = [ libxslt ];
}
''
mkdir -p $out
- ${libxslt.bin}/bin/xsltproc --nonet \
+ xsltproc --nonet \
--stringparam serviceDirectories "$serviceDirectories" \
--stringparam suidHelper "$suidHelper" \
${./make-system-conf.xsl} ${dbus}/share/dbus-1/system.conf \
> $out/system.conf
- ${libxslt.bin}/bin/xsltproc --nonet \
+ xsltproc --nonet \
--stringparam serviceDirectories "$serviceDirectories" \
${./make-session-conf.xsl} ${dbus}/share/dbus-1/session.conf \
> $out/session.conf
diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix
index 870f77686b3e7..387ecc1b6cf02 100644
--- a/pkgs/development/libraries/gobject-introspection/default.nix
+++ b/pkgs/development/libraries/gobject-introspection/default.nix
@@ -1,6 +1,7 @@
{ stdenv, fetchurl, glib, flex, bison, pkgconfig, libffi, python
, libintlOrEmpty, cctools, cairo
, substituteAll, nixStoreDir ? builtins.storeDir
+, x11Support ? true
}:
# now that gobjectIntrospection creates large .gir files (eg gtk3 case)
# it may be worth thinking about using multiple derivation outputs
@@ -43,12 +44,11 @@ stdenv.mkDerivation rec {
src = ./absolute_shlib_path.patch;
inherit nixStoreDir;
})
- # https://github.com/NixOS/nixpkgs/issues/34080
+ ] ++ stdenv.lib.optional x11Support # https://github.com/NixOS/nixpkgs/issues/34080
(substituteAll {
src = ./absolute_gir_path.patch;
cairoLib = "${getLib cairo}/lib";
- })
- ];
+ });
meta = with stdenv.lib; {
description = "A middleware layer between C libraries and language bindings";
diff --git a/pkgs/development/libraries/libunwind/default.nix b/pkgs/development/libraries/libunwind/default.nix
index 6afdac3fdf5c3..b901d352808e9 100644
--- a/pkgs/development/libraries/libunwind/default.nix
+++ b/pkgs/development/libraries/libunwind/default.nix
@@ -33,4 +33,6 @@ stdenv.mkDerivation rec {
platforms = platforms.linux;
license = licenses.mit;
};
+
+ passthru.supportsHost = !stdenv.hostPlatform.isRiscV;
}
diff --git a/pkgs/development/perl-modules/generic/builder.sh b/pkgs/development/perl-modules/generic/builder.sh
index 1b8888dd3ceb0..937dad971b87d 100644
--- a/pkgs/development/perl-modules/generic/builder.sh
+++ b/pkgs/development/perl-modules/generic/builder.sh
@@ -22,7 +22,7 @@ preConfigure() {
fi
done
- perl Makefile.PL PREFIX=$out INSTALLDIRS=site $makeMakerFlags
+ perl Makefile.PL PREFIX=$out INSTALLDIRS=site $makeMakerFlags PERL=$(type -P perl) FULLPERL=$perl/bin/perl
}
diff --git a/pkgs/development/perl-modules/generic/default.nix b/pkgs/development/perl-modules/generic/default.nix
index 9e21a141c728d..b33861d83eed1 100644
--- a/pkgs/development/perl-modules/generic/default.nix
+++ b/pkgs/development/perl-modules/generic/default.nix
@@ -1,6 +1,6 @@
perl:
-{ buildInputs ? [], name, ... } @ attrs:
+{ nativeBuildInputs ? [], name, ... } @ attrs:
perl.stdenv.mkDerivation (
{
@@ -27,6 +27,7 @@ perl.stdenv.mkDerivation (
{
name = "perl-" + name;
builder = ./builder.sh;
- buildInputs = buildInputs ++ [ perl ];
+ nativeBuildInputs = nativeBuildInputs ++ [ (perl.dev or perl) ];
+ inherit perl;
}
)
diff --git a/pkgs/development/tools/misc/strace/default.nix b/pkgs/development/tools/misc/strace/default.nix
index 80d1a75e801d4..f5da3f9daa4de 100644
--- a/pkgs/development/tools/misc/strace/default.nix
+++ b/pkgs/development/tools/misc/strace/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, libunwind }:
+{ stdenv, fetchurl, perl, libunwind, buildPackages }:
stdenv.mkDerivation rec {
name = "strace-${version}";
@@ -9,11 +9,12 @@ stdenv.mkDerivation rec {
sha256 = "0dsw6xcfrmygidp1dj2ch8cl8icrar7789snkb2r8gh78kdqhxjw";
};
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
nativeBuildInputs = [ perl ];
- buildInputs = [ libunwind ]; # support -k
+ buildInputs = stdenv.lib.optional libunwind.supportsHost [ libunwind ]; # support -k
- configureFlags = stdenv.lib.optional stdenv.hostPlatform.isAarch64 "--enable-mpers=check";
+ configureFlags = stdenv.lib.optional (stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isRiscV) "--enable-mpers=check";
meta = with stdenv.lib; {
homepage = http://strace.io/;
diff --git a/pkgs/os-specific/linux/fuse/common.nix b/pkgs/os-specific/linux/fuse/common.nix
index b9ac015f45918..a10a4f466c7c6 100644
--- a/pkgs/os-specific/linux/fuse/common.nix
+++ b/pkgs/os-specific/linux/fuse/common.nix
@@ -4,6 +4,7 @@
, fusePackages, utillinux, gettext
, autoconf, automake, libtool
, meson, ninja, pkgconfig
+, autoreconfHook
}:
let
@@ -18,6 +19,8 @@ in stdenv.mkDerivation rec {
sha256 = sha256Hash;
};
+ preAutoreconf = "touch config.rpath";
+
patches =
stdenv.lib.optional
(!isFuse3 && stdenv.isAarch64)
@@ -30,8 +33,7 @@ in stdenv.mkDerivation rec {
nativeBuildInputs = if isFuse3
then [ meson ninja pkgconfig ]
- else [ autoconf automake libtool ];
- buildInputs = stdenv.lib.optional (!isFuse3) gettext;
+ else [ autoreconfHook gettext ];
outputs = [ "out" ] ++ stdenv.lib.optional isFuse3 "common";
diff --git a/pkgs/os-specific/linux/iputils/default.nix b/pkgs/os-specific/linux/iputils/default.nix
index a7fbcce317534..3fc4f3b237742 100644
--- a/pkgs/os-specific/linux/iputils/default.nix
+++ b/pkgs/os-specific/linux/iputils/default.nix
@@ -24,16 +24,21 @@ stdenv.mkDerivation rec {
# Disable idn usage w/musl: https://github.com/iputils/iputils/pull/111
makeFlags = [ "USE_GNUTLS=no" ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "USE_IDN=no";
+ depsBuildBuild = [ opensp SGMLSpm docbook_sgml_dtd_31 ];
buildInputs = [
- libsysfs opensp openssl libcap docbook_sgml_dtd_31 SGMLSpm libgcrypt nettle
+ libsysfs openssl libcap libgcrypt nettle
] ++ stdenv.lib.optional (!stdenv.hostPlatform.isMusl) libidn;
- buildFlags = "man all ninfod";
+ # ninfod probably could build on cross, but the Makefile doesn't pass --host etc to the sub configure...
+ buildFlags = "man all" + stdenv.lib.optionalString (!stdenv.isCross) " ninfod";
installPhase =
''
mkdir -p $out/bin
- cp -p ping tracepath clockdiff arping rdisc ninfod/ninfod $out/bin/
+ cp -p ping tracepath clockdiff arping rdisc $out/bin/
+ if [ -x ninfod/ninfod ]; then
+ cp -p ninfod/ninfod $out/bin
+ fi
mkdir -p $out/share/man/man8
cp -p \
diff --git a/pkgs/os-specific/linux/libaio/default.nix b/pkgs/os-specific/linux/libaio/default.nix
index 1e85182d6c35f..e2be136adee15 100644
--- a/pkgs/os-specific/linux/libaio/default.nix
+++ b/pkgs/os-specific/linux/libaio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, fetchpatch }:
stdenv.mkDerivation rec {
version = "0.3.110";
@@ -9,6 +9,11 @@ stdenv.mkDerivation rec {
sha256 = "0zjzfkwd1kdvq6zpawhzisv7qbq1ffs343i5fs9p498pcf7046g0";
};
+ patches = [ (fetchpatch {
+ url = https://pagure.io/libaio/c/da47c32b2ff39e52fbed1622c34b86bc88d7c217.patch;
+ sha256 = "1kqpiswjn549s3w3m89bw5qkl7bw5pvq6gp5cdzd926ymlgivj5c";
+ }) ];
+
makeFlags = "prefix=$(out)";
hardeningDisable = stdenv.lib.optional (stdenv.isi686) "stackprotector";
diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix
index df51284689e27..915613cb0d2da 100644
--- a/pkgs/os-specific/linux/systemd/default.nix
+++ b/pkgs/os-specific/linux/systemd/default.nix
@@ -82,6 +82,12 @@ in
"-Dsysvinit-path="
"-Dsysvrcnd-path="
+
+ "-Dkill-path=${coreutils}/bin/kill"
+ "-Dkmod-path=${kmod}/bin/kmod"
+ "-Dsulogin-path=${utillinux}/bin/sulogin"
+ "-Dmount-path=${utillinux}/bin/mount"
+ "-Dumount-path=${utillinux}/bin/umount"
];
preConfigure =
diff --git a/pkgs/os-specific/linux/util-linux/default.nix b/pkgs/os-specific/linux/util-linux/default.nix
index e8a2b34284964..618ba42e7416c 100644
--- a/pkgs/os-specific/linux/util-linux/default.nix
+++ b/pkgs/os-specific/linux/util-linux/default.nix
@@ -30,7 +30,8 @@ in stdenv.mkDerivation rec {
crossAttrs = {
# Work around use of `AC_RUN_IFELSE'.
- preConfigure = "export scanf_cv_type_modifier=ms";
+ preConfigure = "export scanf_cv_type_modifier=ms" + lib.optionalString (systemd != null)
+ "\nconfigureFlags+=\" --with-systemd --with-systemdsystemunitdir=$bin/lib/systemd/system/\"";
};
preConfigure = lib.optionalString (systemd != null) ''
diff --git a/pkgs/servers/dns/bind/default.nix b/pkgs/servers/dns/bind/default.nix
index c0176db157699..55368ac9a4dc6 100644
--- a/pkgs/servers/dns/bind/default.nix
+++ b/pkgs/servers/dns/bind/default.nix
@@ -1,5 +1,6 @@
{ stdenv, lib, fetchurl, openssl, libtool, perl, libxml2
-, enableSeccomp ? false, libseccomp ? null }:
+, enableSeccomp ? false, libseccomp ? null, buildPackages
+}:
assert enableSeccomp -> libseccomp != null;
@@ -24,6 +25,8 @@ stdenv.mkDerivation rec {
STD_CDEFINES = [ "-DDIG_SIGCHASE=1" ]; # support +sigchase
+ depsBuildBuild = [ buildPackages.stdenv.cc ];
+
configureFlags = [
"--localstatedir=/var"
"--with-libtool"
@@ -39,6 +42,11 @@ stdenv.mkDerivation rec {
"--without-pkcs11"
"--without-purify"
"--without-python"
+ "--with-randomdev=/dev/random"
+ "--with-ecdsa"
+ "--with-gost"
+ "--without-eddsa"
+ "--with-aes"
] ++ lib.optional enableSeccomp "--enable-seccomp";
postInstall = ''
diff --git a/pkgs/tools/networking/dhcpcd/default.nix b/pkgs/tools/networking/dhcpcd/default.nix
index 5b7befb3bf648..255f3bb0aeb02 100644
--- a/pkgs/tools/networking/dhcpcd/default.nix
+++ b/pkgs/tools/networking/dhcpcd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, udev }:
+{ stdenv, fetchurl, pkgconfig, udev, runtimeShellPackage }:
stdenv.mkDerivation rec {
name = "dhcpcd-7.0.1";
@@ -25,6 +25,11 @@ stdenv.mkDerivation rec {
# Check that the udev plugin got built.
postInstall = stdenv.lib.optional (udev != null) "[ -e $out/lib/dhcpcd/dev/udev.so ]";
+ # TODO shlevy remove once patchShebangs is fixed
+ postFixup = ''
+ find $out -type f -print0 | xargs --null sed -i 's|${stdenv.shellPackage}|${runtimeShellPackage}|'
+ '';
+
meta = {
description = "A client for the Dynamic Host Configuration Protocol (DHCP)";
homepage = https://roy.marples.name/projects/dhcpcd;
diff --git a/pkgs/tools/security/sudo/default.nix b/pkgs/tools/security/sudo/default.nix
index 1edd5b60926f7..85dba08255da7 100644
--- a/pkgs/tools/security/sudo/default.nix
+++ b/pkgs/tools/security/sudo/default.nix
@@ -51,7 +51,8 @@ stdenv.mkDerivation rec {
installFlags="sudoers_uid=$(id -u) sudoers_gid=$(id -g) sysconfdir=$out/etc rundir=$TMPDIR/dummy vardir=$TMPDIR/dummy"
'';
- buildInputs = [ coreutils pam groff ];
+ nativeBuildInputs = [ groff ];
+ buildInputs = [ pam ];
enableParallelBuilding = true;
diff --git a/pkgs/tools/text/groff/default.nix b/pkgs/tools/text/groff/default.nix
index 6d01c42f93d12..4495a85b28854 100644
--- a/pkgs/tools/text/groff/default.nix
+++ b/pkgs/tools/text/groff/default.nix
@@ -47,7 +47,7 @@ stdenv.mkDerivation rec {
] ++ stdenv.lib.optionals (ghostscript != null) [
"--with-gs=${ghostscript}/bin/gs"
] ++ stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
- "ac_cv_path_PERL=${perl}/bin/perl"
+ "ac_cv_path_PERL=${buildPackages.perl}/bin/perl"
];
doCheck = true;
@@ -103,6 +103,8 @@ stdenv.mkDerivation rec {
substituteInPlace $perl/bin/grog \
--replace $out/lib/groff/grog $perl/lib/groff/grog
+ '' + stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+ find $perl/ -type f -print0 | xargs --null sed -i 's|${buildPackages.perl}|${perl}|'
'';
meta = with stdenv.lib; {
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index c22c040299e67..b1016bca2ab52 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5646,6 +5646,9 @@ with pkgs;
### SHELLS
+ runtimeShell = "${runtimeShellPackage}/bin/bash";
+ runtimeShellPackage = bash;
+
bash = lowPrio (callPackage ../shells/bash/4.4.nix {
texinfo = null;
interactive = stdenv.isCygwin; # patch for cygwin requires readline support
@@ -12997,7 +13000,7 @@ with pkgs;
iproute = callPackage ../os-specific/linux/iproute { };
iputils = callPackage ../os-specific/linux/iputils {
- inherit (perlPackages) SGMLSpm;
+ inherit (buildPackages.buildPackages.perlPackages) SGMLSpm;
};
iptables = callPackage ../os-specific/linux/iptables { };
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index 815bf73210f66..39a7a55b30b35 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -3835,11 +3835,50 @@ let self = _self // overrides; _self = with self; {
};
DBI = buildPerlPackage rec {
- name = "DBI-1.636";
+ name = "DBI-${version}";
+ version = "1.6.36";
src = fetchurl {
url = "mirror://cpan/authors/id/T/TI/TIMB/${name}.tar.gz";
sha256 = "8f7ddce97c04b4b7a000e65e5d05f679c964d62c8b02c94c1a7d815bb2dd676c";
};
+ postInstall = stdenv.lib.optionalString (perl ? crossVersion) ''
+ mkdir -p $out/lib/perl5/site_perl/cross_perl/${perl.version}/DBI
+ cat > $out/lib/perl5/site_perl/cross_perl/${perl.version}/DBI.pm < $out/lib/perl5/site_perl/cross_perl/${perl.version}/DBI/DBD.pm < \$(BASEEXT).xsi
+
+ # ---
+ ';
+ }
+ 1;
+ EOF
+ '';
meta = {
homepage = http://dbi.perl.org/;
description = "Database independent interface for Perl";
@@ -7607,6 +7646,13 @@ let self = _self // overrides; _self = with self; {
url = mirror://cpan/authors/id/M/MA/MAKAMAKA/JSON-2.90.tar.gz;
sha256 = "127yppvr17qik9pkd1vy901hs4l13kg6rhp76jdgcyask35v7nsd";
};
+ preConfigure = ''
+ cp lib/JSON/backportPP.pm{,orig}
+ echo "1;" > lib/JSON/backportPP.pm
+ '';
+ postConfigure = ''
+ cp lib/JSON/backportPP.pm{,orig}
+ '';
buildInputs = [ TestPod ];
meta = {
description = "JSON (JavaScript Object Notation) encoder/decoder";