mkDerivation: Simply Nix

No hashes were changed by this
This commit is contained in:
John Ericson 2017-08-15 16:13:30 -04:00
parent 63439f8a11
commit a71cf06b16

View File

@ -43,29 +43,21 @@ rec {
, propagatedSandboxProfile ? "" , propagatedSandboxProfile ? ""
, ... } @ attrs: , ... } @ attrs:
let let
dependencies = [ dependencies = map lib.chooseDevOutputs [
(map (drv: drv.nativeDrv or drv) nativeBuildInputs) (map (drv: drv.nativeDrv or drv) nativeBuildInputs
++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh
++ lib.optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh)
(map (drv: drv.crossDrv or drv) buildInputs) (map (drv: drv.crossDrv or drv) buildInputs)
]; ];
propagatedDependencies = [ propagatedDependencies = map lib.chooseDevOutputs [
(map (drv: drv.nativeDrv or drv) propagatedNativeBuildInputs) (map (drv: drv.nativeDrv or drv) propagatedNativeBuildInputs)
(map (drv: drv.crossDrv or drv) propagatedBuildInputs) (map (drv: drv.crossDrv or drv) propagatedBuildInputs)
]; ];
in let
outputs' = outputs' =
outputs ++ outputs ++
(if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []); (if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []);
dependencies' = let
justMap = map lib.chooseDevOutputs dependencies;
nativeBuildInputs = lib.head justMap
++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh
++ lib.optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh;
in [ nativeBuildInputs ] ++ lib.tail justMap;
propagatedDependencies' = map lib.chooseDevOutputs propagatedDependencies;
derivationArg = derivationArg =
(removeAttrs attrs (removeAttrs attrs
["meta" "passthru" "crossAttrs" "pos" ["meta" "passthru" "crossAttrs" "pos"
@ -73,13 +65,13 @@ rec {
"sandboxProfile" "propagatedSandboxProfile"]) "sandboxProfile" "propagatedSandboxProfile"])
// (let // (let
computedSandboxProfile = computedSandboxProfile =
lib.concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies'); lib.concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies);
computedPropagatedSandboxProfile = computedPropagatedSandboxProfile =
lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists propagatedDependencies'); lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists propagatedDependencies);
computedImpureHostDeps = computedImpureHostDeps =
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies')); lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (stdenv.extraBuildInputs ++ lib.concatLists dependencies));
computedPropagatedImpureHostDeps = computedPropagatedImpureHostDeps =
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists propagatedDependencies')); lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists propagatedDependencies));
in in
{ {
name = name + lib.optionalString name = name + lib.optionalString
@ -92,11 +84,11 @@ rec {
userHook = config.stdenv.userHook or null; userHook = config.stdenv.userHook or null;
__ignoreNulls = true; __ignoreNulls = true;
nativeBuildInputs = lib.elemAt dependencies' 0; nativeBuildInputs = lib.elemAt dependencies 0;
buildInputs = lib.elemAt dependencies' 1; buildInputs = lib.elemAt dependencies 1;
propagatedNativeBuildInputs = lib.elemAt propagatedDependencies' 0; propagatedNativeBuildInputs = lib.elemAt propagatedDependencies 0;
propagatedBuildInputs = lib.elemAt propagatedDependencies' 1; propagatedBuildInputs = lib.elemAt propagatedDependencies 1;
# This parameter is sometimes a string, sometimes null, and sometimes a list, yuck # This parameter is sometimes a string, sometimes null, and sometimes a list, yuck
configureFlags = let inherit (lib) optional elem; in configureFlags = let inherit (lib) optional elem; in