summary refs log tree commit diff
diff options
context:
space:
mode:
authorJan Malakhovski <oxij@oxij.org>2018-04-25 18:49:44 +0000
committerJan Malakhovski <oxij@oxij.org>2018-04-26 20:15:51 +0000
commit845fa5692164d0bbe2a1857ba27d1bbb4ae0c0e7 (patch)
tree9afea44bd83292a5edb69f58b4e96a2328198263
parentd834ba6654fc5fa79c6cc8b0d5cdaa5d8f85fd0e (diff)
downloadnixlib-845fa5692164d0bbe2a1857ba27d1bbb4ae0c0e7.tar
nixlib-845fa5692164d0bbe2a1857ba27d1bbb4ae0c0e7.tar.gz
nixlib-845fa5692164d0bbe2a1857ba27d1bbb4ae0c0e7.tar.bz2
nixlib-845fa5692164d0bbe2a1857ba27d1bbb4ae0c0e7.tar.lz
nixlib-845fa5692164d0bbe2a1857ba27d1bbb4ae0c0e7.tar.xz
nixlib-845fa5692164d0bbe2a1857ba27d1bbb4ae0c0e7.tar.zst
nixlib-845fa5692164d0bbe2a1857ba27d1bbb4ae0c0e7.zip
stdenv: cleanup things a little bit
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix55
1 files changed, 29 insertions, 26 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index c7a991572e9c..96e40a78e518 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -131,31 +131,33 @@ rec {
         outputs ++
         (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []);
 
+      computedSandboxProfile =
+        lib.concatMap (input: input.__propagatedSandboxProfile or [])
+          (stdenv.extraNativeBuildInputs
+           ++ stdenv.extraBuildInputs
+           ++ lib.concatLists dependencies);
+
+      computedPropagatedSandboxProfile =
+        lib.concatMap (input: input.__propagatedSandboxProfile or [])
+          (lib.concatLists propagatedDependencies);
+
+      computedImpureHostDeps =
+        lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or [])
+          (stdenv.extraNativeBuildInputs
+           ++ stdenv.extraBuildInputs
+           ++ lib.concatLists dependencies));
+
+      computedPropagatedImpureHostDeps =
+        lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or [])
+          (lib.concatLists propagatedDependencies));
+
       derivationArg =
         (removeAttrs attrs
           ["meta" "passthru" "crossAttrs" "pos"
            "doCheck" "doInstallCheck"
            "__impureHostDeps" "__propagatedImpureHostDeps"
            "sandboxProfile" "propagatedSandboxProfile"])
-        // (let
-          computedSandboxProfile =
-            lib.concatMap (input: input.__propagatedSandboxProfile or [])
-              (stdenv.extraNativeBuildInputs
-               ++ stdenv.extraBuildInputs
-               ++ lib.concatLists dependencies);
-          computedPropagatedSandboxProfile =
-            lib.concatMap (input: input.__propagatedSandboxProfile or [])
-              (lib.concatLists propagatedDependencies);
-          computedImpureHostDeps =
-            lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or [])
-              (stdenv.extraNativeBuildInputs
-               ++ stdenv.extraBuildInputs
-               ++ lib.concatLists dependencies));
-          computedPropagatedImpureHostDeps =
-            lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or [])
-              (lib.concatLists propagatedDependencies));
-        in
-        {
+        // {
           # A hack to make `nix-env -qa` and `nix search` ignore broken packages.
           # TODO(@oxij): remove this assert when something like NixOS/nix#1771 gets merged into nix.
           name = assert validity.handled; name + lib.optionalString
@@ -194,6 +196,13 @@ rec {
 
         } // 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 =
@@ -208,13 +217,7 @@ rec {
             "/bin/sh"
           ];
           __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps;
-        } // lib.optionalAttrs (outputs' != [ "out" ]) {
-          outputs = outputs';
-        } // lib.optionalAttrs doCheck' {
-          doCheck = true;
-        } // lib.optionalAttrs doInstallCheck' {
-          doInstallCheck = true;
-        });
+        };
 
       validity = import ./check-meta.nix {
         inherit lib config meta;