diff options
author | John Ericson <Ericson2314@yahoo.com> | 2018-08-08 15:20:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-08 15:20:39 -0400 |
commit | fe68c9d45026857c330d2c8dda8e6fbea23a6cee (patch) | |
tree | 3f7af0acce2d0b60f7c7d9712968b3b6d9449215 /pkgs | |
parent | 82f338b83701cb1fb87d0b6a83ca20b4dca4f9eb (diff) | |
parent | eb5b313b1669d41f301363824e20cd3669d7da64 (diff) | |
download | nixlib-fe68c9d45026857c330d2c8dda8e6fbea23a6cee.tar nixlib-fe68c9d45026857c330d2c8dda8e6fbea23a6cee.tar.gz nixlib-fe68c9d45026857c330d2c8dda8e6fbea23a6cee.tar.bz2 nixlib-fe68c9d45026857c330d2c8dda8e6fbea23a6cee.tar.lz nixlib-fe68c9d45026857c330d2c8dda8e6fbea23a6cee.tar.xz nixlib-fe68c9d45026857c330d2c8dda8e6fbea23a6cee.tar.zst nixlib-fe68c9d45026857c330d2c8dda8e6fbea23a6cee.zip |
Merge pull request #44517 from oxij/stdenv/shadows
stdenv: simplify a bit using shadowing
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/stdenv/generic/make-derivation.nix | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 48ee68f4c00c..560aa72eb392 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -78,6 +78,15 @@ rec { , ... } @ attrs: let + # TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when + # no package has `doCheck = true`. + doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform; + doInstallCheck' = doInstallCheck && stdenv.hostPlatform == stdenv.buildPlatform; + + outputs' = + outputs ++ + (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []); + fixedOutputDrv = attrs ? outputHash; noNonNativeDeps = builtins.length (depsBuildTarget ++ depsBuildTargetPropagated ++ depsHostHost ++ depsHostHostPropagated @@ -97,6 +106,11 @@ rec { inherit erroneousHardeningFlags hardeningDisable hardeningEnable supportedHardeningFlags; }) else let + doCheck = doCheck'; + doInstallCheck = doInstallCheck'; + + outputs = outputs'; + references = nativeBuildInputs ++ buildInputs ++ propagatedNativeBuildInputs ++ propagatedBuildInputs; @@ -111,7 +125,7 @@ rec { [ (map (drv: drv.__spliced.hostHost or drv) depsHostHost) (map (drv: drv.crossDrv or drv) (buildInputs - ++ lib.optionals doCheck' checkInputs + ++ lib.optionals doCheck checkInputs ++ lib.optionals doInstallCheck' installCheckInputs)) ] [ @@ -133,15 +147,6 @@ rec { ] ]; - # TODO(@oxij, @Ericson2314): This is here to keep the old semantics, remove when - # no package has `doCheck = true`. - doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform; - doInstallCheck' = doInstallCheck && stdenv.hostPlatform == stdenv.buildPlatform; - - outputs' = - outputs ++ - (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []); - computedSandboxProfile = lib.concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraNativeBuildInputs @@ -165,7 +170,6 @@ rec { derivationArg = (removeAttrs attrs ["meta" "passthru" "pos" - "doCheck" "doInstallCheck" "checkInputs" "installCheckInputs" "__impureHostDeps" "__propagatedImpureHostDeps" "sandboxProfile" "propagatedSandboxProfile"]) @@ -212,15 +216,11 @@ rec { ++ optional (elem "host" configurePlatforms) "--host=${stdenv.hostPlatform.config}" ++ optional (elem "target" configurePlatforms) "--target=${stdenv.targetPlatform.config}"; + inherit doCheck doInstallCheck; + + inherit outputs; } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) { NIX_HARDENING_ENABLE = enabledHardeningOptions; - } // lib.optionalAttrs (outputs' != [ "out" ]) { - outputs = outputs'; - } // lib.optionalAttrs doCheck' { - doCheck = true; - } // lib.optionalAttrs doInstallCheck' { - doInstallCheck = true; - } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) { # TODO: remove lib.unique once nix has a list canonicalization primitive __sandboxProfile = @@ -261,9 +261,8 @@ rec { # unless they are comfortable with this default. outputsToInstall = let - outs = outputs'; # the value passed to derivation primitive - hasOutput = out: builtins.elem out outs; - in [( lib.findFirst hasOutput null (["bin" "out"] ++ outs) )]; + hasOutput = out: builtins.elem out outputs; + in [( lib.findFirst hasOutput null (["bin" "out"] ++ outputs) )]; } // attrs.meta or {} # Fill `meta.position` to identify the source location of the package. |