Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/customisation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ rec {
# Only show the error for the first missing argument
error = errorForArg missingArgs.${head (attrNames missingArgs)};

in if missingArgs == {} then makeOverridable f allArgs else abort error;
in if missingArgs == {}
then makeOverridable f allArgs
else throw "lib.customisation.callPackageWith: ${error}";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the motivation for this specific change? It makes it so nix-env -qa no longer fails and just silently drops the attrpath when querying pacakges that have missing arguments (and therefore ofborg and other CI relies on the previous behavior to catch missing argument errors during outpath calculation)

This still smells like a bug in nix-env regardless to me, so this bit in Nixpkgs probably doesn't need to be changed back, but I'm still trying to trace down in that code where/why this throw would be ignored rather than propagated as an eval error

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, this is intended behavior in Nix:

Throw an error message s. This usually aborts Nix expression
evaluation, but in nix-env -qa and other commands that try to
evaluate a set of derivations to get information about those
derivations, a derivation that throws an error is silently skipped
(which is not the case for abort).

https://nixos.org/manual/nix/stable/language/builtins.html#builtins-throw

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh damn yeah. Probably the entire reason this is in nix-env at all is because we historically haven't had anything like this PR, which would've prevented packages from not being evaluatable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert and eval fixes in #278777



/* Like callPackage, but for a function that returns an attribute
Expand Down
2 changes: 1 addition & 1 deletion pkgs/development/compilers/cudatoolkit/flags.nix
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ let

# archNames :: List String
# E.g. [ "Turing" "Ampere" ]
archNames = lists.unique (builtins.map (cap: cudaComputeCapabilityToName.${cap}) cudaCapabilities);
archNames = lists.unique (builtins.map (cap: cudaComputeCapabilityToName.${cap} or (throw "missing cuda compute capability")) cudaCapabilities);

# realArches :: List String
# The real architectures are physical architectures supported by the CUDA version.
Expand Down
4 changes: 2 additions & 2 deletions pkgs/os-specific/darwin/xcode/sdk-pkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ rec {
type = "derivation";
outPath = xcode + "/Contents/Developer/Platforms/${platform}.platform/Developer/SDKs/${platform}${version}.sdk";

platform = stdenv.targetPlatform.xcodePlatform;
version = stdenv.targetPlatform.sdkVer;
platform = stdenv.targetPlatform.xcodePlatform or "";
version = stdenv.targetPlatform.sdkVer or "";
};

binutils = wrapBintoolsWith {
Expand Down
4 changes: 2 additions & 2 deletions pkgs/test/cuda/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ callPackage }:

rec {
cuda-samplesPackages = callPackage ./cuda-samples { };
cuda-samplesPackages = callPackage ./cuda-samples/generic.nix { };
inherit (cuda-samplesPackages)
cuda-samples_cudatoolkit_10
cuda-samples_cudatoolkit_10_0
Expand All @@ -14,7 +14,7 @@ rec {
cuda-samples_cudatoolkit_11_3
cuda-samples_cudatoolkit_11_4;

cuda-library-samplesPackages = callPackage ./cuda-library-samples { };
cuda-library-samplesPackages = callPackage ./cuda-library-samples/generic.nix { };
inherit (cuda-library-samplesPackages)
cuda-library-samples_cudatoolkit_10
cuda-library-samples_cudatoolkit_10_1
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/java-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ in {

jdk-hotspot = callPackage package.jdk-hotspot {};
jre-hotspot = callPackage package.jre-hotspot {};
} // lib.optionalAttrs (package?jdk-openj9) {
jdk-openj9 = callPackage package.jdk-openj9 {};
} // lib.optionalAttrs (package?jre-openj9) {
jre-openj9 = callPackage package.jre-openj9 {};
};

Expand Down