about summary refs log tree commit diff
path: root/pkgs/development/cuda-modules/setup-hooks/mark-for-cudatoolkit-root-hook.sh
blob: 0abd651005c663fa30e9a0f826e41d0d6a2a19b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# shellcheck shell=bash

(( ${hostOffset:?} == -1 && ${targetOffset:?} == 0)) || return 0

echo "Sourcing mark-for-cudatoolkit-root-hook" >&2

markForCUDAToolkit_ROOT() {
    mkdir -p "${prefix:?}/nix-support"
    local markerPath="$prefix/nix-support/include-in-cudatoolkit-root"

    # Return early if the file already exists.
    [[ -f "$markerPath" ]] && return 0

    # Always create the file, even if it's empty, since setup-cuda-hook relies on its existence.
    # However, only populate it if strictDeps is not set.
    touch "$markerPath"

    # Return early if strictDeps is set.
    [[ -n "${strictDeps-}" ]] && return 0

    # Populate the file with the package name and output.
    echo "${pname:?}-${output:?}" > "$markerPath"
}

fixupOutputHooks+=(markForCUDAToolkit_ROOT)