Files
nixpkgs/pkgs/build-support/rust/hooks/maturin-build-hook.sh
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

47 lines
1.3 KiB
Bash

# shellcheck shell=bash disable=SC2154,SC2164
maturinBuildHook() {
echo "Executing maturinBuildHook"
runHook preBuild
# Put the wheel to dist/ so that regular Python tooling can find it.
local dist="$PWD/dist"
if [ -n "${buildAndTestSubdir-}" ]; then
pushd "${buildAndTestSubdir}"
fi
# This is a huge hack, but it's the least invasive way
# to get the required interpreter name for maturin.
local interpreter_path="$(command -v python3 || command -v pypy3)"
local interpreter_name="$($interpreter_path -c 'import os; import sysconfig; print(os.path.basename(sysconfig.get_config_var('\''INCLUDEPY'\'')))')"
local flagsArray=(
"--jobs=$NIX_BUILD_CORES"
"--offline"
"--target" "@rustcTargetSpec@"
"--manylinux" "off"
"--strip"
"--release"
"--out" "$dist"
"--interpreter" "$interpreter_name"
)
concatTo flagsArray maturinBuildFlags
echoCmd 'maturinBuildHook flags' "${flagsArray[@]}"
@setEnv@ maturin build "${flagsArray[@]}"
if [ -n "${buildAndTestSubdir-}" ]; then
popd
fi
# These are python build hooks and may depend on ./dist
runHook postBuild
echo "Finished maturinBuildHook"
}
buildPhase=maturinBuildHook