Skip to content

Commit

Permalink
stdenv: cleanup things a little bit
Browse files Browse the repository at this point in the history
  • Loading branch information
oxij committed Apr 26, 2018
1 parent d834ba6 commit 845fa56
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions pkgs/stdenv/generic/make-derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand All @@ -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;
Expand Down

0 comments on commit 845fa56

Please sign in to comment.