···
# to be built eventually, we would still like to get the error early and without
# having to wait while nix builds a derivation that might not be used.
# See also https://github.com/NixOS/nix/issues/4629
205
-
optionalAttrs (attrs ? disallowedReferences) {
206
-
disallowedReferences = map unsafeDerivationToUntrackedOutpath attrs.disallowedReferences;
208
-
// optionalAttrs (attrs ? disallowedRequisites) {
209
-
disallowedRequisites = map unsafeDerivationToUntrackedOutpath attrs.disallowedRequisites;
211
-
// optionalAttrs (attrs ? allowedReferences) {
212
-
allowedReferences = mapNullable unsafeDerivationToUntrackedOutpath attrs.allowedReferences;
214
-
// optionalAttrs (attrs ? allowedRequisites) {
215
-
allowedRequisites = mapNullable unsafeDerivationToUntrackedOutpath attrs.allowedRequisites;
206
+
${if (attrs ? disallowedReferences) then "disallowedReferences" else null} =
207
+
map unsafeDerivationToUntrackedOutpath attrs.disallowedReferences;
208
+
${if (attrs ? disallowedRequisites) then "disallowedRequisites" else null} =
209
+
map unsafeDerivationToUntrackedOutpath attrs.disallowedRequisites;
210
+
${if (attrs ? allowedReferences) then "allowedReferences" else null} =
211
+
mapNullable unsafeDerivationToUntrackedOutpath attrs.allowedReferences;
212
+
${if (attrs ? allowedRequisites) then "allowedRequisites" else null} =
213
+
mapNullable unsafeDerivationToUntrackedOutpath attrs.allowedRequisites;
···
removeAttrs attrs removedOrReplacedAttrNames
481
-
// (optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
480
+
${if (attrs ? name || (attrs ? pname && attrs ? version)) then "name" else null} =
# Indicate the host platform of the derivation if cross compiling.
# Fixed-output derivations like source tarballs shouldn't get a host
···
) "The `version` attribute cannot be null.";
"${attrs.pname}${staticMarker}${hostSuffix}-${attrs.version}"
builder = attrs.realBuilder or stdenv.shell;
···
inherit doCheck doInstallCheck;
560
-
// optionalAttrs (__contentAddressed) {
561
-
inherit __contentAddressed;
562
-
# Provide default values for outputHashMode and outputHashAlgo because
563
-
# most people won't care about these anyways
564
-
outputHashAlgo = attrs.outputHashAlgo or "sha256";
565
-
outputHashMode = attrs.outputHashMode or "recursive";
567
-
// optionalAttrs (enableParallelBuilding) {
568
-
inherit enableParallelBuilding;
569
-
enableParallelChecking = attrs.enableParallelChecking or true;
570
-
enableParallelInstalling = attrs.enableParallelInstalling or true;
572
-
// optionalAttrs (hardeningDisable != [ ] || hardeningEnable != [ ] || stdenv.hostPlatform.isMusl) {
573
-
NIX_HARDENING_ENABLE = builtins.concatStringsSep " " enabledHardeningOptions;
557
+
# When the derivations is content addressed provide default values
558
+
# for outputHashMode and outputHashAlgo because most people won't
559
+
# care about these anyways
560
+
${if __contentAddressed then "__contentAddressed" else null} = __contentAddressed;
561
+
${if __contentAddressed then "outputHashAlgo" else null} = attrs.outputHashAlgo or "sha256";
562
+
${if __contentAddressed then "outputHashMode" else null} = attrs.outputHashMode or "recursive";
564
+
${if enableParallelBuilding then "enableParallelBuilding" else null} = enableParallelBuilding;
565
+
${if enableParallelBuilding then "enableParallelChecking" else null} =
566
+
attrs.enableParallelChecking or true;
567
+
${if enableParallelBuilding then "enableParallelInstalling" else null} =
568
+
attrs.enableParallelInstalling or true;
571
+
if (hardeningDisable != [ ] || hardeningEnable != [ ] || stdenv.hostPlatform.isMusl) then
572
+
"NIX_HARDENING_ENABLE"
576
+
builtins.concatStringsSep " " enabledHardeningOptions;
# TODO: remove platform condition
# Enabling this check could be a breaking change as it requires to edit nix.conf
# NixOS module already sets gccarch, unsure of nix installers and other distributions
stdenv.buildPlatform ? gcc.arch
stdenv.buildPlatform.isAarch64
···
stdenv.buildPlatform.gcc.arch == "armv8-a"
594
-
requiredSystemFeatures = attrs.requiredSystemFeatures or [ ] ++ [
595
-
"gccarch-${stdenv.buildPlatform.gcc.arch}"
595
+
"requiredSystemFeatures"
599
+
attrs.requiredSystemFeatures or [ ] ++ [
600
+
"gccarch-${stdenv.buildPlatform.gcc.arch}"
// optionalAttrs (stdenv.buildPlatform.isDarwin) (
allDependencies = concatLists (concatLists dependencies);