diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2019-12-05 09:14:08 +0100 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2019-12-05 09:14:08 +0100 |
commit | 51ef7c3e497ec09d4bc6b67c7e47e61c308454aa (patch) | |
tree | b0fd889cc90b9fdc732df4f9c1c4a85419104b4f /pkgs/build-support | |
parent | 30fae2883e655c170e76d0827bcd9f396e9658af (diff) | |
parent | 1451a52a38f2dda459647a5c2628e7c28e17c4dc (diff) | |
download | nixlib-51ef7c3e497ec09d4bc6b67c7e47e61c308454aa.tar nixlib-51ef7c3e497ec09d4bc6b67c7e47e61c308454aa.tar.gz nixlib-51ef7c3e497ec09d4bc6b67c7e47e61c308454aa.tar.bz2 nixlib-51ef7c3e497ec09d4bc6b67c7e47e61c308454aa.tar.lz nixlib-51ef7c3e497ec09d4bc6b67c7e47e61c308454aa.tar.xz nixlib-51ef7c3e497ec09d4bc6b67c7e47e61c308454aa.tar.zst nixlib-51ef7c3e497ec09d4bc6b67c7e47e61c308454aa.zip |
Merge master into staging-next
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/agda/default.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/trivial-builders.nix | 29 | ||||
-rw-r--r-- | pkgs/build-support/vm/windows/default.nix | 3 |
3 files changed, 26 insertions, 8 deletions
diff --git a/pkgs/build-support/agda/default.nix b/pkgs/build-support/agda/default.nix index 16fe748c3e5c..3e5d8e6c384c 100644 --- a/pkgs/build-support/agda/default.nix +++ b/pkgs/build-support/agda/default.nix @@ -1,6 +1,4 @@ # Builder for Agda packages. Mostly inspired by the cabal builder. -# -# Contact: stdenv.lib.maintainers.fuuzetsu { stdenv, Agda, glibcLocales , writeShellScriptBin diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index 55df09121b42..5210b7d7ba20 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -2,11 +2,16 @@ let - runCommand' = stdenv: name: env: buildCommand: + runCommand' = runLocal: stdenv: name: env: buildCommand: stdenv.mkDerivation ({ inherit name buildCommand; passAsFile = [ "buildCommand" ]; - } // env); + } + // (lib.optionalAttrs runLocal { + preferLocalBuild = true; + allowSubstitutes = false; + }) + // env); in @@ -21,11 +26,27 @@ rec { * runCommand "name" {envVariable = true;} ''echo hello > $out'' * runCommandNoCC "name" {envVariable = true;} ''echo hello > $out'' # equivalent to prior * runCommandCC "name" {} ''gcc -o myfile myfile.c; cp myfile $out''; + * + * The `*Local` variants force a derivation to be built locally, + * it is not substituted. + * + * This is intended for very cheap commands (<1s execution time). + * It saves on the network roundrip and can speed up a build. + * + * It is the same as adding the special fields + * `preferLocalBuild = true;` + * `allowSubstitutes = false;` + * to a derivation’s attributes. */ runCommand = runCommandNoCC; - runCommandNoCC = runCommand' stdenvNoCC; - runCommandCC = runCommand' stdenv; + runCommandLocal = runCommandNoCCLocal; + + runCommandNoCC = runCommand' false stdenvNoCC; + runCommandNoCCLocal = runCommand' true stdenvNoCC; + runCommandCC = runCommand' false stdenv; + # `runCommandCCLocal` left out on purpose. + # We shouldn’t force the user to have a cc in scope. /* Writes a text file to the nix store. * The contents of text is added to the file in the store. diff --git a/pkgs/build-support/vm/windows/default.nix b/pkgs/build-support/vm/windows/default.nix index 48ee2713d1f6..309241c36dee 100644 --- a/pkgs/build-support/vm/windows/default.nix +++ b/pkgs/build-support/vm/windows/default.nix @@ -20,8 +20,7 @@ let ''; in { - runInWindowsVM = drv: let - in pkgs.lib.overrideDerivation drv (attrs: let + runInWindowsVM = drv: pkgs.lib.overrideDerivation drv (attrs: let bootstrap = bootstrapper attrs.windowsImage; in { requiredSystemFeatures = [ "kvm" ]; |