deterministic-uname: add setup hook

Several packages were adding deterministic-uname to `nativeBuildInputs`,
but that is insufficient for its use. Add a setup hook to make its use
more obvious
This commit is contained in:
Artemis Tosini 2026-06-12 16:01:52 -04:00
commit 36559eb1b9
No known key found for this signature in database
2 changed files with 11 additions and 0 deletions

View file

@ -46,6 +46,9 @@ replaceVarsWith {
modDirVersion = if modDirVersion != "" then modDirVersion else "unknown";
};
# coreutils uname is in initialPath, so ordinarily appears in PATH before packages in nativeBuildInputs.
setupHook = ./setup-hook.sh;
meta = {
description = "Print certain system information (hardcoded with lib/system values)";
mainProgram = "uname";

View file

@ -0,0 +1,8 @@
# PATH is overwritten after package setup hooks are run,
# so the variable change needs to be delayed until a phase.
# An entry in prePhases is the earliest possible, useful
# in case an unpack or patch hook attempts to run uname.
unamePreHook() {
export PATH="@out@/bin:$PATH"
}
appendToVar prePhases unamePreHook