From a915b33315946b9e7d164d57812ee16172ad65df Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Thu, 8 Nov 2018 11:59:03 +0100 Subject: [PATCH] nixos: add preferLocalBuild=true; on derivations for config files --- .../config/fonts/fontconfig-penultimate.nix | 4 +++- nixos/modules/config/fonts/fontconfig-ultimate.nix | 2 +- nixos/modules/config/fonts/fontconfig.nix | 2 +- nixos/modules/config/fonts/fontdir.nix | 2 +- .../video/uvcvideo/uvcdynctrl-udev-rules.nix | 1 + nixos/modules/installer/cd-dvd/channel.nix | 2 +- nixos/modules/programs/less.nix | 2 +- nixos/modules/security/ca.nix | 1 + nixos/modules/security/sudo.nix | 5 ++++- .../continuous-integration/buildkite-agent.nix | 2 +- .../continuous-integration/gitlab-runner.nix | 1 + nixos/modules/services/databases/hbase.nix | 2 +- nixos/modules/services/databases/influxdb.nix | 1 + nixos/modules/services/hardware/acpid.nix | 2 +- nixos/modules/services/hardware/tlp.nix | 1 + nixos/modules/services/logging/logcheck.nix | 2 +- nixos/modules/services/logging/logstash.nix | 5 ++++- nixos/modules/services/mail/opensmtpd.nix | 2 +- nixos/modules/services/misc/gitolite.nix | 2 +- nixos/modules/services/misc/nix-daemon.nix | 2 +- nixos/modules/services/misc/taskserver/default.nix | 2 +- nixos/modules/services/monitoring/apcupsd.nix | 2 +- nixos/modules/services/monitoring/graphite.nix | 6 ++++-- nixos/modules/services/monitoring/nagios.nix | 6 ++++-- nixos/modules/services/monitoring/netdata.nix | 2 +- .../services/monitoring/prometheus/default.nix | 2 +- nixos/modules/services/monitoring/scollector.nix | 2 +- nixos/modules/services/monitoring/telegraf.nix | 1 + nixos/modules/services/monitoring/uptime.nix | 3 ++- .../services/network-filesystems/beegfs.nix | 5 ++++- .../modules/services/network-filesystems/ipfs.nix | 2 +- .../network-filesystems/openafs/client.nix | 4 ++-- nixos/modules/services/networking/dnscache.nix | 2 +- .../services/networking/hylafax/systemd.nix | 2 +- nixos/modules/services/networking/prayer.nix | 2 +- nixos/modules/services/networking/shout.nix | 2 +- nixos/modules/services/networking/xrdp.nix | 2 +- nixos/modules/services/printing/cupsd.nix | 5 +++-- nixos/modules/services/ttys/kmscon.nix | 2 +- nixos/modules/services/web-apps/codimd.nix | 2 +- .../services/web-servers/apache-httpd/default.nix | 3 ++- .../web-servers/apache-httpd/mediawiki.nix | 7 ++++--- .../services/web-servers/phpfpm/default.nix | 1 + nixos/modules/services/web-servers/traefik.nix | 1 + .../services/x11/desktop-managers/gnome3.nix | 2 +- .../display-managers/lightdm-greeters/enso-os.nix | 7 ++++--- .../x11/display-managers/lightdm-greeters/gtk.nix | 7 ++++--- .../modules/services/x11/display-managers/slim.nix | 2 +- nixos/modules/services/x11/gdk-pixbuf.nix | 2 +- nixos/modules/services/x11/xserver.nix | 2 ++ nixos/modules/system/boot/stage-1.nix | 14 ++++++++------ nixos/modules/system/boot/systemd.nix | 5 ++++- nixos/modules/tasks/filesystems/vboxsf.nix | 2 +- nixos/modules/tasks/kbd.nix | 1 + nixos/modules/tasks/network-interfaces.nix | 2 +- pkgs/build-support/closure-info.nix | 2 ++ 56 files changed, 99 insertions(+), 60 deletions(-) diff --git a/nixos/modules/config/fonts/fontconfig-penultimate.nix b/nixos/modules/config/fonts/fontconfig-penultimate.nix index 7e05e77d967a..2c18244621af 100644 --- a/nixos/modules/config/fonts/fontconfig-penultimate.nix +++ b/nixos/modules/config/fonts/fontconfig-penultimate.nix @@ -55,7 +55,9 @@ let localConf = pkgs.writeText "fc-local.conf" cfg.localConf; # The configuration to be included in /etc/font/ - penultimateConf = pkgs.runCommand "font-penultimate-conf" {} '' + penultimateConf = pkgs.runCommand "font-penultimate-conf" { + preferLocalBuild = true; + } '' support_folder=$out/etc/fonts/conf.d latest_folder=$out/etc/fonts/${latestVersion}/conf.d diff --git a/nixos/modules/config/fonts/fontconfig-ultimate.nix b/nixos/modules/config/fonts/fontconfig-ultimate.nix index 7549dc6c0651..45328f3eaf13 100644 --- a/nixos/modules/config/fonts/fontconfig-ultimate.nix +++ b/nixos/modules/config/fonts/fontconfig-ultimate.nix @@ -7,7 +7,7 @@ let cfg = config.fonts.fontconfig.ultimate; latestVersion = pkgs.fontconfig.configVersion; # The configuration to be included in /etc/font/ - confPkg = pkgs.runCommand "font-ultimate-conf" {} '' + confPkg = pkgs.runCommand "font-ultimate-conf" { preferLocalBuild = true; } '' support_folder=$out/etc/fonts/conf.d latest_folder=$out/etc/fonts/${latestVersion}/conf.d diff --git a/nixos/modules/config/fonts/fontconfig.nix b/nixos/modules/config/fonts/fontconfig.nix index 12f5ca2e7993..d79c43c0b5b9 100644 --- a/nixos/modules/config/fonts/fontconfig.nix +++ b/nixos/modules/config/fonts/fontconfig.nix @@ -190,7 +190,7 @@ let cfg = config.fonts.fontconfig; ''; # fontconfig configuration package - confPkg = pkgs.runCommand "fontconfig-conf" {} '' + confPkg = pkgs.runCommand "fontconfig-conf" { preferLocalBuild = true; } '' support_folder=$out/etc/fonts latest_folder=$out/etc/fonts/${latestVersion} diff --git a/nixos/modules/config/fonts/fontdir.nix b/nixos/modules/config/fonts/fontdir.nix index 180e38f81f4f..cc70fbf8744d 100644 --- a/nixos/modules/config/fonts/fontdir.nix +++ b/nixos/modules/config/fonts/fontdir.nix @@ -4,7 +4,7 @@ with lib; let - x11Fonts = pkgs.runCommand "X11-fonts" { } '' + x11Fonts = pkgs.runCommand "X11-fonts" { preferLocalBuild = true; } '' mkdir -p "$out/share/X11-fonts" find ${toString config.fonts.fonts} \ \( -name fonts.dir -o -name '*.ttf' -o -name '*.otf' \) \ diff --git a/nixos/modules/hardware/video/uvcvideo/uvcdynctrl-udev-rules.nix b/nixos/modules/hardware/video/uvcvideo/uvcdynctrl-udev-rules.nix index 2cf5f13bc159..a808429c9996 100644 --- a/nixos/modules/hardware/video/uvcvideo/uvcdynctrl-udev-rules.nix +++ b/nixos/modules/hardware/video/uvcvideo/uvcdynctrl-udev-rules.nix @@ -29,6 +29,7 @@ runCommand "uvcdynctrl-udev-rules-${version}" ]; dontPatchELF = true; dontStrip = true; + preferLocalBuild = true; } '' mkdir -p "$out/lib/udev" diff --git a/nixos/modules/installer/cd-dvd/channel.nix b/nixos/modules/installer/cd-dvd/channel.nix index e946c4abc576..ab5e7c0645f3 100644 --- a/nixos/modules/installer/cd-dvd/channel.nix +++ b/nixos/modules/installer/cd-dvd/channel.nix @@ -13,7 +13,7 @@ let # user, as expected by nixos-rebuild/nixos-install. FIXME: merge # with make-channel.nix. channelSources = pkgs.runCommand "nixos-${config.system.nixos.version}" - { } + { preferLocalBuild = true; } '' mkdir -p $out cp -prd ${nixpkgs.outPath} $out/nixos diff --git a/nixos/modules/programs/less.nix b/nixos/modules/programs/less.nix index d39103a58057..9fdf99e9c694 100644 --- a/nixos/modules/programs/less.nix +++ b/nixos/modules/programs/less.nix @@ -25,7 +25,7 @@ let ''; lessKey = pkgs.runCommand "lesskey" - { src = pkgs.writeText "lessconfig" configText; } + { src = pkgs.writeText "lessconfig" configText; preferLocalBuild = true; } "${pkgs.less}/bin/lesskey -o $out $src"; in diff --git a/nixos/modules/security/ca.nix b/nixos/modules/security/ca.nix index 67469be18b41..1c4ee421fc56 100644 --- a/nixos/modules/security/ca.nix +++ b/nixos/modules/security/ca.nix @@ -14,6 +14,7 @@ let { files = cfg.certificateFiles ++ [ (builtins.toFile "extra.crt" (concatStringsSep "\n" cfg.certificates)) ]; + preferLocalBuild = true; } '' cat $files > $out diff --git a/nixos/modules/security/sudo.nix b/nixos/modules/security/sudo.nix index 69a2a4f8f9ae..573588aaeecc 100644 --- a/nixos/modules/security/sudo.nix +++ b/nixos/modules/security/sudo.nix @@ -215,7 +215,10 @@ in environment.etc = singleton { source = pkgs.runCommand "sudoers" - { src = pkgs.writeText "sudoers-in" cfg.configFile; } + { + src = pkgs.writeText "sudoers-in" cfg.configFile; + preferLocalBuild = true; + } # Make sure that the sudoers file is syntactically valid. # (currently disabled - NIXOS-66) "${pkgs.buildPackages.sudo}/sbin/visudo -f $src -c && cp $src $out"; diff --git a/nixos/modules/services/continuous-integration/buildkite-agent.nix b/nixos/modules/services/continuous-integration/buildkite-agent.nix index 9daf391c73c4..2136778aff47 100644 --- a/nixos/modules/services/continuous-integration/buildkite-agent.nix +++ b/nixos/modules/services/continuous-integration/buildkite-agent.nix @@ -24,7 +24,7 @@ let EOF chmod 755 $out/${name} ''; - in pkgs.runCommand "buildkite-agent-hooks" {} '' + in pkgs.runCommand "buildkite-agent-hooks" { preferLocalBuild = true; } '' mkdir $out ${concatStringsSep "\n" (mapAttrsToList mkHookEntry (filterAttrs (n: v: v != null) cfg.hooks))} ''; diff --git a/nixos/modules/services/continuous-integration/gitlab-runner.nix b/nixos/modules/services/continuous-integration/gitlab-runner.nix index a0aff1b8b5b9..3ceaa6f5ff3e 100644 --- a/nixos/modules/services/continuous-integration/gitlab-runner.nix +++ b/nixos/modules/services/continuous-integration/gitlab-runner.nix @@ -8,6 +8,7 @@ let if (cfg.configFile == null) then (pkgs.runCommand "config.toml" { buildInputs = [ pkgs.remarshal ]; + preferLocalBuild = true; } '' remarshal -if json -of toml \ < ${pkgs.writeText "config.json" (builtins.toJSON cfg.configOptions)} \ diff --git a/nixos/modules/services/databases/hbase.nix b/nixos/modules/services/databases/hbase.nix index 4772e897efe2..52f2d95b4e00 100644 --- a/nixos/modules/services/databases/hbase.nix +++ b/nixos/modules/services/databases/hbase.nix @@ -18,7 +18,7 @@ let ''; - configDir = pkgs.runCommand "hbase-config-dir" {} '' + configDir = pkgs.runCommand "hbase-config-dir" { preferLocalBuild = true; } '' mkdir -p $out cp ${cfg.package}/conf/* $out/ rm $out/hbase-site.xml diff --git a/nixos/modules/services/databases/influxdb.nix b/nixos/modules/services/databases/influxdb.nix index d7a028b25d8d..888bf13c3df8 100644 --- a/nixos/modules/services/databases/influxdb.nix +++ b/nixos/modules/services/databases/influxdb.nix @@ -98,6 +98,7 @@ let configFile = pkgs.runCommand "config.toml" { buildInputs = [ pkgs.remarshal ]; + preferLocalBuild = true; } '' remarshal -if json -of toml \ < ${pkgs.writeText "config.json" (builtins.toJSON configOptions)} \ diff --git a/nixos/modules/services/hardware/acpid.nix b/nixos/modules/services/hardware/acpid.nix index 0f05876aee32..4c97485d9726 100644 --- a/nixos/modules/services/hardware/acpid.nix +++ b/nixos/modules/services/hardware/acpid.nix @@ -21,7 +21,7 @@ let }; }; - acpiConfDir = pkgs.runCommand "acpi-events" {} + acpiConfDir = pkgs.runCommand "acpi-events" { preferLocalBuild = true; } '' mkdir -p $out ${ diff --git a/nixos/modules/services/hardware/tlp.nix b/nixos/modules/services/hardware/tlp.nix index b894025c0fd5..092ff051a042 100644 --- a/nixos/modules/services/hardware/tlp.nix +++ b/nixos/modules/services/hardware/tlp.nix @@ -17,6 +17,7 @@ tlp = pkgs.tlp.override { confFile = pkgs.runCommand "tlp" { config = cfg.extraConfig; passAsFile = [ "config" ]; + preferLocalBuild = true; } '' cat ${tlp}/etc/default/tlp > $out diff --git a/nixos/modules/services/logging/logcheck.nix b/nixos/modules/services/logging/logcheck.nix index 1477d273d5ee..9c64160e92bc 100644 --- a/nixos/modules/services/logging/logcheck.nix +++ b/nixos/modules/services/logging/logcheck.nix @@ -5,7 +5,7 @@ with lib; let cfg = config.services.logcheck; - defaultRules = pkgs.runCommand "logcheck-default-rules" {} '' + defaultRules = pkgs.runCommand "logcheck-default-rules" { preferLocalBuild = true; } '' cp -prd ${pkgs.logcheck}/etc/logcheck $out chmod u+w $out rm -r $out/logcheck.* diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix index aa019d855ea9..9b707e9deb58 100644 --- a/nixos/modules/services/logging/logstash.nix +++ b/nixos/modules/services/logging/logstash.nix @@ -27,7 +27,10 @@ let logstashSettingsYml = pkgs.writeText "logstash.yml" cfg.extraSettings; - logstashSettingsDir = pkgs.runCommand "logstash-settings" {inherit logstashSettingsYml;} '' + logstashSettingsDir = pkgs.runCommand "logstash-settings" { + inherit logstashSettingsYml; + preferLocalBuild = true; + } '' mkdir -p $out ln -s $logstashSettingsYml $out/logstash.yml ''; diff --git a/nixos/modules/services/mail/opensmtpd.nix b/nixos/modules/services/mail/opensmtpd.nix index 4276552d4f03..a870550ba50b 100644 --- a/nixos/modules/services/mail/opensmtpd.nix +++ b/nixos/modules/services/mail/opensmtpd.nix @@ -8,7 +8,7 @@ let conf = pkgs.writeText "smtpd.conf" cfg.serverConfiguration; args = concatStringsSep " " cfg.extraServerArgs; - sendmail = pkgs.runCommand "opensmtpd-sendmail" {} '' + sendmail = pkgs.runCommand "opensmtpd-sendmail" { preferLocalBuild = true; } '' mkdir -p $out/bin ln -s ${cfg.package}/sbin/smtpctl $out/bin/sendmail ''; diff --git a/nixos/modules/services/misc/gitolite.nix b/nixos/modules/services/misc/gitolite.nix index b9c2a966e6f5..c7f2a168f8ab 100644 --- a/nixos/modules/services/misc/gitolite.nix +++ b/nixos/modules/services/misc/gitolite.nix @@ -110,7 +110,7 @@ in config = mkIf cfg.enable ( let manageGitoliteRc = cfg.extraGitoliteRc != ""; - rcDir = pkgs.runCommand "gitolite-rc" { } rcDirScript; + rcDir = pkgs.runCommand "gitolite-rc" { preferLocalBuild = true; } rcDirScript; rcDirScript = '' mkdir "$out" diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 9a8116a03e88..665215822af8 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -33,7 +33,7 @@ let sh = pkgs.runtimeShell; binshDeps = pkgs.writeReferencesToFile sh; in - pkgs.runCommand "nix.conf" { extraOptions = cfg.extraOptions; } ('' + pkgs.runCommand "nix.conf" { preferLocalBuild = true; extraOptions = cfg.extraOptions; } ('' ${optionalString (!isNix20) '' extraPaths=$(for i in $(cat ${binshDeps}); do if test -d $i; then echo $i; fi; done) ''} diff --git a/nixos/modules/services/misc/taskserver/default.nix b/nixos/modules/services/misc/taskserver/default.nix index 5f97abf18715..483bc99ad946 100644 --- a/nixos/modules/services/misc/taskserver/default.nix +++ b/nixos/modules/services/misc/taskserver/default.nix @@ -109,7 +109,7 @@ let nixos-taskserver = pkgs.pythonPackages.buildPythonApplication { name = "nixos-taskserver"; - src = pkgs.runCommand "nixos-taskserver-src" {} '' + src = pkgs.runCommand "nixos-taskserver-src" { preferLocalBuild = true; } '' mkdir -p "$out" cat "${pkgs.substituteAll { src = ./helper-tool.py; diff --git a/nixos/modules/services/monitoring/apcupsd.nix b/nixos/modules/services/monitoring/apcupsd.nix index 7ee870183cac..49957e652900 100644 --- a/nixos/modules/services/monitoring/apcupsd.nix +++ b/nixos/modules/services/monitoring/apcupsd.nix @@ -45,7 +45,7 @@ let eventToShellCmds = event: if builtins.hasAttr event cfg.hooks then (shellCmdsForEventScript event (builtins.getAttr event cfg.hooks)) else ""; - scriptDir = pkgs.runCommand "apcupsd-scriptdir" {} ('' + scriptDir = pkgs.runCommand "apcupsd-scriptdir" { preferLocalBuild = true; } ('' mkdir "$out" # Copy SCRIPTDIR from apcupsd package cp -r ${pkgs.apcupsd}/etc/apcupsd/* "$out"/ diff --git a/nixos/modules/services/monitoring/graphite.nix b/nixos/modules/services/monitoring/graphite.nix index cdc98b407e90..f59bc56962b1 100644 --- a/nixos/modules/services/monitoring/graphite.nix +++ b/nixos/modules/services/monitoring/graphite.nix @@ -9,8 +9,10 @@ let dataDir = cfg.dataDir; staticDir = cfg.dataDir + "/static"; - graphiteLocalSettingsDir = pkgs.runCommand "graphite_local_settings" - {inherit graphiteLocalSettings;} '' + graphiteLocalSettingsDir = pkgs.runCommand "graphite_local_settings" { + inherit graphiteLocalSettings; + preferLocalBuild = true; + } '' mkdir -p $out ln -s $graphiteLocalSettings $out/graphite_local_settings.py ''; diff --git a/nixos/modules/services/monitoring/nagios.nix b/nixos/modules/services/monitoring/nagios.nix index 3e1d727b416e..e5496209f827 100644 --- a/nixos/modules/services/monitoring/nagios.nix +++ b/nixos/modules/services/monitoring/nagios.nix @@ -11,8 +11,10 @@ let nagiosObjectDefs = cfg.objectDefs; - nagiosObjectDefsDir = pkgs.runCommand "nagios-objects" {inherit nagiosObjectDefs;} - "mkdir -p $out; ln -s $nagiosObjectDefs $out/"; + nagiosObjectDefsDir = pkgs.runCommand "nagios-objects" { + inherit nagiosObjectDefs; + preferLocalBuild = true; + } "mkdir -p $out; ln -s $nagiosObjectDefs $out/"; nagiosCfgFile = pkgs.writeText "nagios.cfg" '' diff --git a/nixos/modules/services/monitoring/netdata.nix b/nixos/modules/services/monitoring/netdata.nix index 1d86c5d893de..a49555cf677f 100644 --- a/nixos/modules/services/monitoring/netdata.nix +++ b/nixos/modules/services/monitoring/netdata.nix @@ -5,7 +5,7 @@ with lib; let cfg = config.services.netdata; - wrappedPlugins = pkgs.runCommand "wrapped-plugins" {} '' + wrappedPlugins = pkgs.runCommand "wrapped-plugins" { preferLocalBuild = true; } '' mkdir -p $out/libexec/netdata/plugins.d ln -s /run/wrappers/bin/apps.plugin $out/libexec/netdata/plugins.d/apps.plugin ''; diff --git a/nixos/modules/services/monitoring/prometheus/default.nix b/nixos/modules/services/monitoring/prometheus/default.nix index 1b1503ab5fc0..cc703573d8cd 100644 --- a/nixos/modules/services/monitoring/prometheus/default.nix +++ b/nixos/modules/services/monitoring/prometheus/default.nix @@ -19,7 +19,7 @@ let # Pretty-print JSON to a file writePrettyJSON = name: x: - pkgs.runCommand name { } '' + pkgs.runCommand name { preferLocalBuild = true; } '' echo '${builtins.toJSON x}' | ${pkgs.jq}/bin/jq . > $out ''; diff --git a/nixos/modules/services/monitoring/scollector.nix b/nixos/modules/services/monitoring/scollector.nix index 6ecb21d628de..fbded746a5f7 100644 --- a/nixos/modules/services/monitoring/scollector.nix +++ b/nixos/modules/services/monitoring/scollector.nix @@ -5,7 +5,7 @@ with lib; let cfg = config.services.scollector; - collectors = pkgs.runCommand "collectors" {} + collectors = pkgs.runCommand "collectors" { preferLocalBuild = true; } '' mkdir -p $out ${lib.concatStringsSep diff --git a/nixos/modules/services/monitoring/telegraf.nix b/nixos/modules/services/monitoring/telegraf.nix index 6bfcd7143e1c..d87867326682 100644 --- a/nixos/modules/services/monitoring/telegraf.nix +++ b/nixos/modules/services/monitoring/telegraf.nix @@ -7,6 +7,7 @@ let configFile = pkgs.runCommand "config.toml" { buildInputs = [ pkgs.remarshal ]; + preferLocalBuild = true; } '' remarshal -if json -of toml \ < ${pkgs.writeText "config.json" (builtins.toJSON cfg.extraConfig)} \ diff --git a/nixos/modules/services/monitoring/uptime.nix b/nixos/modules/services/monitoring/uptime.nix index b4d3a2640109..c0993f3bc2e7 100644 --- a/nixos/modules/services/monitoring/uptime.nix +++ b/nixos/modules/services/monitoring/uptime.nix @@ -4,7 +4,8 @@ let cfg = config.services.uptime; - configDir = pkgs.runCommand "config" {} (if cfg.configFile != null then '' + configDir = pkgs.runCommand "config" { preferLocalBuild = true; } + (if cfg.configFile != null then '' mkdir $out ext=`echo ${cfg.configFile} | grep -o \\..*` ln -sv ${cfg.configFile} $out/default$ext diff --git a/nixos/modules/services/network-filesystems/beegfs.nix b/nixos/modules/services/network-filesystems/beegfs.nix index d9dde3f6bb67..86b1bb9160f1 100644 --- a/nixos/modules/services/network-filesystems/beegfs.nix +++ b/nixos/modules/services/network-filesystems/beegfs.nix @@ -102,7 +102,10 @@ let # wrappers to beegfs tools. Avoid typing path of config files utilWrappers = mapAttrsToList ( name: cfg: - ( pkgs.runCommand "beegfs-utils-${name}" { nativeBuildInputs = [ pkgs.makeWrapper ]; } '' + ( pkgs.runCommand "beegfs-utils-${name}" { + nativeBuildInputs = [ pkgs.makeWrapper ]; + preferLocalBuild = true; + } '' mkdir -p $out/bin makeWrapper ${pkgs.beegfs}/bin/beegfs-check-servers \ diff --git a/nixos/modules/services/network-filesystems/ipfs.nix b/nixos/modules/services/network-filesystems/ipfs.nix index 602cd50d8f55..d4fa1eccdf3b 100644 --- a/nixos/modules/services/network-filesystems/ipfs.nix +++ b/nixos/modules/services/network-filesystems/ipfs.nix @@ -19,7 +19,7 @@ let "/var/lib/ipfs/.ipfs"; # Wrapping the ipfs binary with the environment variable IPFS_PATH set to dataDir because we can't set it in the user environment - wrapped = runCommand "ipfs" { buildInputs = [ makeWrapper ]; } '' + wrapped = runCommand "ipfs" { buildInputs = [ makeWrapper ]; preferLocalBuild = true; } '' mkdir -p "$out/bin" makeWrapper "${ipfs}/bin/ipfs" "$out/bin/ipfs" \ --set IPFS_PATH ${cfg.dataDir} \ diff --git a/nixos/modules/services/network-filesystems/openafs/client.nix b/nixos/modules/services/network-filesystems/openafs/client.nix index 240c1392088f..93d2d7fcd975 100644 --- a/nixos/modules/services/network-filesystems/openafs/client.nix +++ b/nixos/modules/services/network-filesystems/openafs/client.nix @@ -15,7 +15,7 @@ let clientServDB = pkgs.writeText "client-cellServDB-${cfg.cellName}" (mkCellServDB cfg.cellName cfg.cellServDB); - afsConfig = pkgs.runCommand "afsconfig" {} '' + afsConfig = pkgs.runCommand "afsconfig" { preferLocalBuild = true; } '' mkdir -p $out echo ${cfg.cellName} > $out/ThisCell cat ${cellServDB} ${clientServDB} > $out/CellServDB @@ -198,7 +198,7 @@ in environment.etc = { clientCellServDB = { - source = pkgs.runCommand "CellServDB" {} '' + source = pkgs.runCommand "CellServDB" { preferLocalBuild = true; } '' cat ${cellServDB} ${clientServDB} > $out ''; target = "openafs/CellServDB"; diff --git a/nixos/modules/services/networking/dnscache.nix b/nixos/modules/services/networking/dnscache.nix index fc30f50317fe..5051fc916d96 100644 --- a/nixos/modules/services/networking/dnscache.nix +++ b/nixos/modules/services/networking/dnscache.nix @@ -5,7 +5,7 @@ with lib; let cfg = config.services.dnscache; - dnscache-root = pkgs.runCommand "dnscache-root" {} '' + dnscache-root = pkgs.runCommand "dnscache-root" { preferLocalBuild = true; } '' mkdir -p $out/{servers,ip} ${concatMapStrings (ip: '' diff --git a/nixos/modules/services/networking/hylafax/systemd.nix b/nixos/modules/services/networking/hylafax/systemd.nix index 91d9c1a37da6..ef177e4be345 100644 --- a/nixos/modules/services/networking/hylafax/systemd.nix +++ b/nixos/modules/services/networking/hylafax/systemd.nix @@ -41,7 +41,7 @@ let "$out/config.${name}" ''; in - pkgs.runCommand "hylafax-config-modems" {} + pkgs.runCommand "hylafax-config-modems" { preferLocalBuild = true; } ''mkdir --parents "$out/" ${concatStringsSep "\n" (mapModems mkLine)}''; setupSpoolScript = pkgs.substituteAll { diff --git a/nixos/modules/services/networking/prayer.nix b/nixos/modules/services/networking/prayer.nix index f63f86496bee..c936417e68cb 100644 --- a/nixos/modules/services/networking/prayer.nix +++ b/nixos/modules/services/networking/prayer.nix @@ -25,7 +25,7 @@ let ${cfg.extraConfig} ''; - prayerCfg = pkgs.runCommand "prayer.cf" { } '' + prayerCfg = pkgs.runCommand "prayer.cf" { preferLocalBuild = true; } '' # We have to remove the http_port 80, or it will start a server there cat ${prayer}/etc/prayer.cf | grep -v http_port > $out cat ${prayerExtraCfg} >> $out diff --git a/nixos/modules/services/networking/shout.nix b/nixos/modules/services/networking/shout.nix index 1ea676d0f929..f511a9af2562 100644 --- a/nixos/modules/services/networking/shout.nix +++ b/nixos/modules/services/networking/shout.nix @@ -6,7 +6,7 @@ let cfg = config.services.shout; shoutHome = "/var/lib/shout"; - defaultConfig = pkgs.runCommand "config.js" {} '' + defaultConfig = pkgs.runCommand "config.js" { preferLocalBuild = true; } '' EDITOR=true ${pkgs.shout}/bin/shout config --home $PWD mv config.js $out ''; diff --git a/nixos/modules/services/networking/xrdp.nix b/nixos/modules/services/networking/xrdp.nix index a1c5d879f3cb..cc18f6d0064c 100644 --- a/nixos/modules/services/networking/xrdp.nix +++ b/nixos/modules/services/networking/xrdp.nix @@ -4,7 +4,7 @@ with lib; let cfg = config.services.xrdp; - confDir = pkgs.runCommand "xrdp.conf" { } '' + confDir = pkgs.runCommand "xrdp.conf" { preferLocalBuild = true; } '' mkdir $out cp ${cfg.package}/etc/xrdp/{km-*,xrdp,sesman,xrdp_keyboard}.ini $out diff --git a/nixos/modules/services/printing/cupsd.nix b/nixos/modules/services/printing/cupsd.nix index 3a43ebbb889c..854c76cc0a16 100644 --- a/nixos/modules/services/printing/cupsd.nix +++ b/nixos/modules/services/printing/cupsd.nix @@ -11,8 +11,9 @@ let avahiEnabled = config.services.avahi.enable; polkitEnabled = config.security.polkit.enable; - additionalBackends = pkgs.runCommand "additional-cups-backends" { } - '' + additionalBackends = pkgs.runCommand "additional-cups-backends" { + preferLocalBuild = true; + } '' mkdir -p $out if [ ! -e ${cups.out}/lib/cups/backend/smb ]; then mkdir -p $out/lib/cups/backend diff --git a/nixos/modules/services/ttys/kmscon.nix b/nixos/modules/services/ttys/kmscon.nix index 82b6a51028e3..dc37f9bee4b3 100644 --- a/nixos/modules/services/ttys/kmscon.nix +++ b/nixos/modules/services/ttys/kmscon.nix @@ -82,7 +82,7 @@ in { X-RestartIfChanged=false ''; - systemd.units."autovt@.service".unit = pkgs.runCommand "unit" { } + systemd.units."autovt@.service".unit = pkgs.runCommand "unit" { preferLocalBuild = true; } '' mkdir -p $out ln -s ${config.systemd.units."kmsconvt@.service".unit}/kmsconvt@.service $out/autovt@.service diff --git a/nixos/modules/services/web-apps/codimd.nix b/nixos/modules/services/web-apps/codimd.nix index a0af28eac7cc..56e1de17e3c3 100644 --- a/nixos/modules/services/web-apps/codimd.nix +++ b/nixos/modules/services/web-apps/codimd.nix @@ -6,7 +6,7 @@ let cfg = config.services.codimd; prettyJSON = conf: - pkgs.runCommand "codimd-config.json" { } '' + pkgs.runCommand "codimd-config.json" { preferLocalBuild = true; } '' echo '${builtins.toJSON conf}' | ${pkgs.jq}/bin/jq \ '{production:del(.[]|nulls)|del(.[][]?|nulls)}' > $out ''; diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 3fd19d425c74..1eac5be2f8d3 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -217,7 +217,7 @@ let ) null ([ cfg ] ++ subservices); documentRoot = if maybeDocumentRoot != null then maybeDocumentRoot else - pkgs.runCommand "empty" {} "mkdir -p $out"; + pkgs.runCommand "empty" { preferLocalBuild = true; } "mkdir -p $out"; documentRootConf = '' DocumentRoot "${documentRoot}" @@ -426,6 +426,7 @@ let phpIni = pkgs.runCommand "php.ini" { options = concatStringsSep "\n" ([ mainCfg.phpOptions ] ++ (map (svc: svc.phpOptions) allSubservices)); + preferLocalBuild = true; } '' cat ${php}/etc/php.ini > $out diff --git a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix index e871ae6ff15a..6234478014ce 100644 --- a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix +++ b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix @@ -116,9 +116,10 @@ let ''; }; - mediawikiScripts = pkgs.runCommand "mediawiki-${config.id}-scripts" - { buildInputs = [ pkgs.makeWrapper ]; } - '' + mediawikiScripts = pkgs.runCommand "mediawiki-${config.id}-scripts" { + buildInputs = [ pkgs.makeWrapper ]; + preferLocalBuild = true; + } '' mkdir -p $out/bin for i in changePassword.php createAndPromote.php userOptions.php edit.php nukePage.php update.php; do makeWrapper ${php}/bin/php $out/bin/mediawiki-${config.id}-$(basename $i .php) \ diff --git a/nixos/modules/services/web-servers/phpfpm/default.nix b/nixos/modules/services/web-servers/phpfpm/default.nix index 97c730061bd1..ffafbc5e92f2 100644 --- a/nixos/modules/services/web-servers/phpfpm/default.nix +++ b/nixos/modules/services/web-servers/phpfpm/default.nix @@ -39,6 +39,7 @@ let phpIni = pool: pkgs.runCommand "php.ini" { inherit (pool) phpPackage phpOptions; + preferLocalBuild = true; nixDefaults = '' sendmail_path = "/run/wrappers/bin/sendmail -t -i" ''; diff --git a/nixos/modules/services/web-servers/traefik.nix b/nixos/modules/services/web-servers/traefik.nix index 700202b1d28f..4674ed0177e6 100644 --- a/nixos/modules/services/web-servers/traefik.nix +++ b/nixos/modules/services/web-servers/traefik.nix @@ -8,6 +8,7 @@ let if cfg.configFile == null then pkgs.runCommand "config.toml" { buildInputs = [ pkgs.remarshal ]; + preferLocalBuild = true; } '' remarshal -if json -of toml \ < ${pkgs.writeText "config.json" (builtins.toJSON cfg.configOptions)} \ diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 31ff60019aea..6255dce8276f 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -15,7 +15,7 @@ let ''; }; - nixos-gsettings-desktop-schemas = pkgs.runCommand "nixos-gsettings-desktop-schemas" {} + nixos-gsettings-desktop-schemas = pkgs.runCommand "nixos-gsettings-desktop-schemas" { preferLocalBuild = true; } '' mkdir -p $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas cp -rf ${pkgs.gnome3.gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas*/glib-2.0/schemas/*.xml $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix index 7c794b1ba175..de128809ce30 100644 --- a/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix +++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/enso-os.nix @@ -12,9 +12,10 @@ let # We need a few things in the environment for the greeter to run with # fonts/icons. - wrappedEnsoGreeter = pkgs.runCommand "lightdm-enso-os-greeter" - { buildInputs = [ pkgs.makeWrapper ]; } - '' + wrappedEnsoGreeter = pkgs.runCommand "lightdm-enso-os-greeter" { + buildInputs = [ pkgs.makeWrapper ]; + preferLocalBuild = true; + } '' # This wrapper ensures that we actually get themes makeWrapper ${pkgs.lightdm-enso-os-greeter}/bin/pantheon-greeter \ $out/greeter \ diff --git a/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix b/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix index efec943c0075..772cc95e84e5 100644 --- a/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix +++ b/nixos/modules/services/x11/display-managers/lightdm-greeters/gtk.nix @@ -18,9 +18,10 @@ let # The default greeter provided with this expression is the GTK greeter. # Again, we need a few things in the environment for the greeter to run with # fonts/icons. - wrappedGtkGreeter = pkgs.runCommand "lightdm-gtk-greeter" - { buildInputs = [ pkgs.makeWrapper ]; } - '' + wrappedGtkGreeter = pkgs.runCommand "lightdm-gtk-greeter" { + buildInputs = [ pkgs.makeWrapper ]; + preferLocalBuild = true; + } '' # This wrapper ensures that we actually get themes makeWrapper ${pkgs.lightdm_gtk_greeter}/sbin/lightdm-gtk-greeter \ $out/greeter \ diff --git a/nixos/modules/services/x11/display-managers/slim.nix b/nixos/modules/services/x11/display-managers/slim.nix index 4e411c8ceb0b..124660a43f07 100644 --- a/nixos/modules/services/x11/display-managers/slim.nix +++ b/nixos/modules/services/x11/display-managers/slim.nix @@ -28,7 +28,7 @@ let # Unpack the SLiM theme, or use the default. slimThemesDir = let - unpackedTheme = pkgs.runCommand "slim-theme" {} + unpackedTheme = pkgs.runCommand "slim-theme" { preferLocalBuild = true; } '' mkdir -p $out cd $out diff --git a/nixos/modules/services/x11/gdk-pixbuf.nix b/nixos/modules/services/x11/gdk-pixbuf.nix index 58faa8e2f9df..2dc8eabd95a7 100644 --- a/nixos/modules/services/x11/gdk-pixbuf.nix +++ b/nixos/modules/services/x11/gdk-pixbuf.nix @@ -10,7 +10,7 @@ let # Generate the cache file by running gdk-pixbuf-query-loaders for each # package and concatenating the results. - loadersCache = pkgs.runCommand "gdk-pixbuf-loaders.cache" {} '' + loadersCache = pkgs.runCommand "gdk-pixbuf-loaders.cache" { preferLocalBuild = true; } '' ( for package in ${concatStringsSep " " effectivePackages}; do module_dir="$package/${pkgs.gdk_pixbuf.moduleDir}" diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 34ae8c11a3f0..06e09d0d51ca 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -113,6 +113,7 @@ let { xfs = optionalString (cfg.useXFS != false) ''FontPath "${toString cfg.useXFS}"''; inherit (cfg) config; + preferLocalBuild = true; } '' echo 'Section "Files"' >> $out @@ -705,6 +706,7 @@ in system.extraDependencies = singleton (pkgs.runCommand "xkb-validated" { inherit (cfg) xkbModel layout xkbVariant xkbOptions; nativeBuildInputs = [ pkgs.xkbvalidate ]; + preferLocalBuild = true; } '' validate "$xkbModel" "$layout" "$xkbVariant" "$xkbOptions" touch "$out" diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 5e27b24ac447..9984a97bbdd2 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -196,9 +196,10 @@ let ''; # */ - udevRules = pkgs.runCommand "udev-rules" - { allowedReferences = [ extraUtils ]; } - '' + udevRules = pkgs.runCommand "udev-rules" { + allowedReferences = [ extraUtils ]; + preferLocalBuild = true; + } '' mkdir -p $out echo 'ENV{LD_LIBRARY_PATH}="${extraUtils}/lib"' > $out/00-env.rules @@ -298,9 +299,10 @@ let { object = pkgs.writeText "mdadm.conf" config.boot.initrd.mdadmConf; symlink = "/etc/mdadm.conf"; } - { object = pkgs.runCommand "initrd-kmod-blacklist-ubuntu" - { src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf"; } - '' + { object = pkgs.runCommand "initrd-kmod-blacklist-ubuntu" { + src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf"; + preferLocalBuild = true; + } '' target=$out ${pkgs.buildPackages.perl}/bin/perl -0pe 's/## file: iwlwifi.conf(.+?)##/##/s;' $src > $out ''; diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 9fdef0251d70..bf1b1b417b16 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -759,7 +759,10 @@ in environment.etc = let # generate contents for /etc/systemd/system-generators from # systemd.generators and systemd.generator-packages - generators = pkgs.runCommand "system-generators" { packages = cfg.generator-packages; } '' + generators = pkgs.runCommand "system-generators" { + preferLocalBuild = true; + packages = cfg.generator-packages; + } '' mkdir -p $out for package in $packages do diff --git a/nixos/modules/tasks/filesystems/vboxsf.nix b/nixos/modules/tasks/filesystems/vboxsf.nix index 87f1984f084f..5497194f6a8d 100644 --- a/nixos/modules/tasks/filesystems/vboxsf.nix +++ b/nixos/modules/tasks/filesystems/vboxsf.nix @@ -6,7 +6,7 @@ let inInitrd = any (fs: fs == "vboxsf") config.boot.initrd.supportedFilesystems; - package = pkgs.runCommand "mount.vboxsf" {} '' + package = pkgs.runCommand "mount.vboxsf" { preferLocalBuild = true; } '' mkdir -p $out/bin cp ${pkgs.linuxPackages.virtualboxGuestAdditions}/bin/mount.vboxsf $out/bin ''; diff --git a/nixos/modules/tasks/kbd.nix b/nixos/modules/tasks/kbd.nix index fbe42b8e8f04..6d34f897d189 100644 --- a/nixos/modules/tasks/kbd.nix +++ b/nixos/modules/tasks/kbd.nix @@ -15,6 +15,7 @@ let optimizedKeymap = pkgs.runCommand "keymap" { nativeBuildInputs = [ pkgs.buildPackages.kbd ]; LOADKEYS_KEYMAP_PATH = "${kbdEnv}/share/keymaps/**"; + preferLocalBuild = true; } '' 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 815523093dde..f9b0eb330bf8 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -995,7 +995,7 @@ in ''; environment.etc."hostid" = mkIf (cfg.hostId != null) - { source = pkgs.runCommand "gen-hostid" {} '' + { source = pkgs.runCommand "gen-hostid" { preferLocalBuild = true; } '' hi="${cfg.hostId}" ${if pkgs.stdenv.isBigEndian then '' echo -ne "\x''${hi:0:2}\x''${hi:2:2}\x''${hi:4:2}\x''${hi:6:2}" > $out diff --git a/pkgs/build-support/closure-info.nix b/pkgs/build-support/closure-info.nix index 28f2802a5bce..24795a724ec8 100644 --- a/pkgs/build-support/closure-info.nix +++ b/pkgs/build-support/closure-info.nix @@ -17,6 +17,8 @@ stdenv.mkDerivation { exportReferencesGraph.closure = rootPaths; + preferLocalBuild = true; + PATH = "${buildPackages.coreutils}/bin:${buildPackages.jq}/bin"; builder = builtins.toFile "builder"