stdenv: refactor (no change in semantics)

This just moves some expressions around in preparation to further changes.

authored by Vladimír Čunát and committed by John Ericson 7fdf18e8 74f55017

+41 -34
+41 -34
pkgs/stdenv/generic/default.nix
··· 290 in [ nativeBuildInputs buildInputs ]; 291 292 propagatedDependencies' = map lib.chooseDevOutputs propagatedDependencies; 293 - in 294 295 # Throw an error if trying to evaluate an non-valid derivation 296 - assert let v = checkValidity attrs; 297 in if !v.valid 298 then throwEvalHelp (removeAttrs v ["valid"]) 299 else true; 300 301 - lib.addPassthru (derivation ( 302 (removeAttrs attrs 303 ["meta" "passthru" "crossAttrs" "pos" 304 "__impureHostDeps" "__propagatedImpureHostDeps" ··· 343 __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps; 344 } // (if outputs' != [ "out" ] then { 345 outputs = outputs'; 346 - } else { })))) ( 347 - { 348 - overrideAttrs = f: mkDerivation (attrs // (f attrs)); 349 - # The meta attribute is passed in the resulting attribute set, 350 - # but it's not part of the actual derivation, i.e., it's not 351 - # passed to the builder and is not a dependency. But since we 352 - # include it in the result, it *is* available to nix-env for queries. 353 - meta = { } 354 - # If the packager hasn't specified `outputsToInstall`, choose a default, 355 - # which is the name of `p.bin or p.out or p`; 356 - # if he has specified it, it will be overridden below in `// meta`. 357 - # Note: This default probably shouldn't be globally configurable. 358 - # Services and users should specify outputs explicitly, 359 - # unless they are comfortable with this default. 360 - // { outputsToInstall = 361 - let 362 - outs = outputs'; # the value passed to derivation primitive 363 - hasOutput = out: builtins.elem out outs; 364 - in [( lib.findFirst hasOutput null (["bin" "out"] ++ outs) )]; 365 - } 366 - // meta 367 - # Fill `meta.position` to identify the source location of the package. 368 - // lib.optionalAttrs (pos' != null) 369 - { position = pos'.file + ":" + toString pos'.line; } 370 - ; 371 - inherit passthru; 372 - } // 373 - # Pass through extra attributes that are not inputs, but 374 - # should be made available to Nix expressions using the 375 - # derivation (e.g., in assertions). 376 - passthru); 377 378 # The stdenv that we are producing. 379 result =
··· 290 in [ nativeBuildInputs buildInputs ]; 291 292 propagatedDependencies' = map lib.chooseDevOutputs propagatedDependencies; 293 294 # Throw an error if trying to evaluate an non-valid derivation 295 + validityCondition = 296 + let v = checkValidity attrs; 297 in if !v.valid 298 then throwEvalHelp (removeAttrs v ["valid"]) 299 else true; 300 301 + derivationArg = 302 (removeAttrs attrs 303 ["meta" "passthru" "crossAttrs" "pos" 304 "__impureHostDeps" "__propagatedImpureHostDeps" ··· 343 __propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps; 344 } // (if outputs' != [ "out" ] then { 345 outputs = outputs'; 346 + } else { })); 347 + 348 + # The meta attribute is passed in the resulting attribute set, 349 + # but it's not part of the actual derivation, i.e., it's not 350 + # passed to the builder and is not a dependency. But since we 351 + # include it in the result, it *is* available to nix-env for queries. 352 + meta = { } 353 + # If the packager hasn't specified `outputsToInstall`, choose a default, 354 + # which is the name of `p.bin or p.out or p`; 355 + # if he has specified it, it will be overridden below in `// meta`. 356 + # Note: This default probably shouldn't be globally configurable. 357 + # Services and users should specify outputs explicitly, 358 + # unless they are comfortable with this default. 359 + // { outputsToInstall = 360 + let 361 + outs = outputs'; # the value passed to derivation primitive 362 + hasOutput = out: builtins.elem out outs; 363 + in [( lib.findFirst hasOutput null (["bin" "out"] ++ outs) )]; 364 + } 365 + // attrs.meta or {} 366 + # Fill `meta.position` to identify the source location of the package. 367 + // lib.optionalAttrs (pos' != null) 368 + { position = pos'.file + ":" + toString pos'.line; } 369 + ; 370 + 371 + in 372 + 373 + assert validityCondition; 374 + 375 + lib.addPassthru (derivation derivationArg) ( 376 + { 377 + overrideAttrs = f: mkDerivation (attrs // (f attrs)); 378 + inherit meta passthru; 379 + } // 380 + # Pass through extra attributes that are not inputs, but 381 + # should be made available to Nix expressions using the 382 + # derivation (e.g., in assertions). 383 + passthru); 384 385 # The stdenv that we are producing. 386 result =