foundation/basic: Set the phase for nom

https://github.com/maralorn/nix-output-monitor
1a9ba0d6fe/src/libutil/logging.cc (L441)

Co-authored-by: dawn <dawnofmidnight@duck.com>
This commit is contained in:
Ross Smyth 2025-10-24 16:39:23 -04:00
parent 57a4021ce9
commit 0b7e7d1e52

View file

@ -50,6 +50,12 @@ in
script = lib.strings.concatMapSep "\n" (entry: ''
# Phase: ${entry.name}
# ====================================================
if [[ -v NIX_LOG_FD ]]; then
# Sends a JSON command to the Nix build daemon, which sets the phase of the build allowing
# nix-output-monitor to display the phase properly.
# https://github.com/NixOS/nix/blob/1a9ba0d6fe7b6c05e8bbe1c59ead420759b631cc/src/libutil/logging.cc#L441
echo '@nix { "action": "setPhase", "phase": "${entry.name}" }' >&"$NIX_LOG_FD"
fi
${entry.value}
'') sorted.result;