Skip to content

Conversation

@SomeoneSerge
Copy link
Collaborator

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@SomeoneSerge
Copy link
Collaborator Author

RE: NixOS#459416 (comment)

@SomeoneSerge
Copy link
Collaborator Author

@ConnorBaker ConnorBaker force-pushed the feat/cuda-stub-setup-hook branch from 3721b48 to 3397e9f Compare November 24, 2025 21:03
newRunpathEntries+=("$driverLinkLib")
((++driverLinkLibSightings))
((++driverLinkLibSightings )) || true # NOTE: (( 0 )) sets exit code 1
Copy link
Owner

Choose a reason for hiding this comment

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

Doing the pre-increment is how we avoid (( 0 )), so no need for || true.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I much prefer explicit || true without the 4LOC comment

Copy link
Owner

Choose a reason for hiding this comment

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

|| true is redundant when using a pre-increment on a variable with a lower bound of zero. I'll shrink the comment.

*-cuda*/lib/stubs)
*-cuda*-stubs/lib)
Copy link
Owner

Choose a reason for hiding this comment

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

Stubs should not exist at the top-level inside lib; I made symlinks previously so autoPatchelfHook could find them since it does not recurse into lib, but that was a bad approach.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I used to keep stubs in a separate output at precisely this level, and on a separate notice I was about to ask why you merged cudart into a single output.

Copy link
Owner

Choose a reason for hiding this comment

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

Build scripts and projects assume the directory layout matches what we've got in the redistributables and patching them to respect multiple outputs is too big a headache. I noticed a number of failures building with CUDA 13 because directory traversal through relative paths was assumed to work but cuda_cudart was split into multiple outputs. It was stupid hard for me to get the CUDA 13 PR merged and I couldn't care about rooting out and fixing all those breakages so I just consolidated -- same thing for cuda_nvcc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

patching them to respect multiple outputs is too big a headach

True, that's why we had the extra output with symlinks. One argument I have for the extra output is that we've been lately trying to guarantee that .sos can be found at predictable locations ${out}/lib/${soname}.so, so ${lib}/lib/stubs/libcuda.so -> ${stubs}/lib/libcuda.so... well ok nits

-- same thing for cuda_nvcc.

Yeah this one we never really managed to split properly, the cyclical references...

@ConnorBaker ConnorBaker force-pushed the feat/cuda-stub-setup-hook branch from 3397e9f to e5f409d Compare November 24, 2025 21:17
Comment on lines 354 to 355
printWords >>"''${!outputStubs:?}/nix-support/propagatedNativeBuildInputs" \
"${getDev removeStubsFromRunpathHook}"
Copy link
Owner

Choose a reason for hiding this comment

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

It's not enough to just record add the dependency to propagated-native-build-inputs -- that only works if we use stubs exclusively from depsHostHost or later (like buildInputs): https://github.com/ConnorBaker/nix-propagation-behavior/blob/1afbd58f2af1468d4564722b7180cc4d89967ef3/README.md?plain=1#L13-L18

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, I had momentary doubts whether propagatedBuildInputs was treated differently from propagatedNativeBuildInputs except for offsets. It must be the (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue block. So should just use propagatedBuildInputs instead

Copy link
Owner

Choose a reason for hiding this comment

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

propagated-build-inputs would mean that we'd have offsets (-1, 0) if the stubs are in nativeBuildInputs and (0, 1) if the stubs are in buildInputs. I think we want (-1, 0) at most.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

propagated-build-inputs would mean that we'd have offsets (-1, 0) if the stubs are in nativeBuildInputs

Yes, precisely, so it's within bounds of findInputs

@SomeoneSerge SomeoneSerge force-pushed the feat/cuda-stub-setup-hook branch from b6abf26 to 3e172af Compare November 24, 2025 21:51
@ConnorBaker ConnorBaker force-pushed the feat/cuda-stub-setup-hook branch from e5f409d to 9d38d18 Compare November 25, 2025 01:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants