Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

63 lines
1.6 KiB
Nix

{
lib,
backendStdenv,
setupCudaHook,
}:
prevAttrs: {
# Merge "bin" and "dev" into "out" to avoid circular references
outputs = builtins.filter (
x:
!(builtins.elem x [
"dev"
"bin"
])
) prevAttrs.outputs or [ ];
# Patch the nvcc.profile.
# Syntax:
# - `=` for assignment,
# - `?=` for conditional assignment,
# - `+=` to "prepend",
# - `=+` to "append".
# Cf. https://web.archive.org/web/20230308044351/https://arcb.csc.ncsu.edu/~mueller/cluster/nvidia/2.0/nvcc_2.0.pdf
# We set all variables with the lowest priority (=+), but we do force
# nvcc to use the fixed backend toolchain. Cf. comments in
# backend-stdenv.nix
postPatch =
prevAttrs.postPatch or ""
+ ''
substituteInPlace bin/nvcc.profile \
--replace-fail \
'$(TOP)/$(_TARGET_DIR_)/include' \
"''${!outputDev}/include"
''
+ ''
cat << EOF >> bin/nvcc.profile
# Fix a compatible backend compiler
PATH += "${backendStdenv.cc}/bin":
# Expose the split-out nvvm
LIBRARIES =+ "-L''${!outputBin}/nvvm/lib"
INCLUDES =+ "-I''${!outputBin}/nvvm/include"
EOF
'';
# Entries here will be in nativeBuildInputs when cuda_nvcc is in nativeBuildInputs.
propagatedBuildInputs = prevAttrs.propagatedBuildInputs or [ ] ++ [ setupCudaHook ];
postInstall = prevAttrs.postInstall or "" + ''
moveToOutput "nvvm" "''${!outputBin}"
'';
# The nvcc and cicc binaries contain hard-coded references to /usr
allowFHSReferences = true;
meta = prevAttrs.meta or { } // {
mainProgram = "nvcc";
};
}