stdenv: Have mkDerivation pull the "extra" arguments from stdenv instead

Something more elaborate is needed for the "*Platform" arguments.
This commit is contained in:
John Ericson 2017-07-05 19:58:24 -04:00
parent 4cf4d7180d
commit afc2023993
2 changed files with 6 additions and 10 deletions

View File

@ -71,6 +71,8 @@ let
platforms = lib.platforms.all; platforms = lib.platforms.all;
}; };
inherit extraBuildInputs __extraImpureHostDeps extraSandboxProfile;
# Utility flags to test the type of platform. # Utility flags to test the type of platform.
inherit (hostPlatform) inherit (hostPlatform)
isDarwin isLinux isSunOS isHurd isCygwin isFreeBSD isOpenBSD isDarwin isLinux isSunOS isHurd isCygwin isFreeBSD isOpenBSD
@ -85,9 +87,6 @@ let
inherit lib config stdenv; inherit lib config stdenv;
# TODO(@Ericson2314): Remove # TODO(@Ericson2314): Remove
inherit inherit
extraBuildInputs
__extraImpureHostDeps
extraSandboxProfile
hostPlatform targetPlatform; hostPlatform targetPlatform;
}) mkDerivation; }) mkDerivation;

View File

@ -1,9 +1,6 @@
{ lib, config, stdenv { lib, config, stdenv
# TODO(@Ericson2314): get off stdenv # TODO(@Ericson2314): get off stdenv
, extraBuildInputs
, __extraImpureHostDeps
, extraSandboxProfile
, hostPlatform, targetPlatform , hostPlatform, targetPlatform
}: }:
@ -73,11 +70,11 @@ rec {
// (let // (let
# TODO(@Ericson2314): Reversing of dep lists is just temporary to avoid Darwin mass rebuild. # TODO(@Ericson2314): Reversing of dep lists is just temporary to avoid Darwin mass rebuild.
computedSandboxProfile = computedSandboxProfile =
lib.concatMap (input: input.__propagatedSandboxProfile or []) (extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies')); lib.concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies'));
computedPropagatedSandboxProfile = computedPropagatedSandboxProfile =
lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists (lib.reverseList propagatedDependencies')); lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists (lib.reverseList propagatedDependencies'));
computedImpureHostDeps = computedImpureHostDeps =
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies'))); lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (stdenv.extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies')));
computedPropagatedImpureHostDeps = computedPropagatedImpureHostDeps =
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists (lib.reverseList propagatedDependencies'))); lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists (lib.reverseList propagatedDependencies')));
in in
@ -97,11 +94,11 @@ rec {
} // lib.optionalAttrs (hostPlatform.isDarwin) { } // lib.optionalAttrs (hostPlatform.isDarwin) {
# TODO: remove lib.unique once nix has a list canonicalization primitive # TODO: remove lib.unique once nix has a list canonicalization primitive
__sandboxProfile = __sandboxProfile =
let profiles = [ extraSandboxProfile ] ++ computedSandboxProfile ++ computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile sandboxProfile ]; let profiles = [ stdenv.extraSandboxProfile ] ++ computedSandboxProfile ++ computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile sandboxProfile ];
final = lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.unique profiles)); final = lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.unique profiles));
in final; in final;
__propagatedSandboxProfile = lib.unique (computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile ]); __propagatedSandboxProfile = lib.unique (computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile ]);
__impureHostDeps = computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ __extraImpureHostDeps ++ [ __impureHostDeps = computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ stdenv.__extraImpureHostDeps ++ [
"/dev/zero" "/dev/zero"
"/dev/random" "/dev/random"
"/dev/urandom" "/dev/urandom"