Automagically add --rebuild to nix build commands in interactive mode
[?]
Apr 11, 2023, 9:58 PM
FYBNOJLTCRNCVUO65HCB5KI6OVOBU5AWG5RKMENQEFDPWZYKCVIACDependencies
- [2]
7KPFEFGSSkip rebuilds in automatic mode - [3]
U6EHWR7YTweak --gcroots - [4]
VGNXPE5DOnly rebuild the vm integration test in interactive mode - [5]
3GPSC2KXAdd compatibility checks for fancy parts of the demos - [6]
VUARRVTIClean up strings - [7]
ZV5WPO25Extend 02 - [8]
WNFTZY3MOptionally prevent relevant nix store paths from being GC'ed - [9]
BH5XPS7CAdd 07-vm-integration test - [10]
TEQJC3HXAdd 03-nix-container - [11]
VXZ5QMIEFix CI - [12]
W2G433QURefactor libdemo and flakeref for nix run commands - [*]
VMUKZQZRWork on 02-nix-build
Change contents
- replacement in bash/nix-container-demo-helper.sh at line 37[5.650]→[5.650:732](∅→∅),[5.732]→[3.1115:1211](∅→∅),[3.1211]→[5.842:909](∅→∅),[5.842]→[5.842:909](∅→∅)
local -r storepath="${1}"echo "Preventing GC for '${storepath}'"local -r gcroot="${__nix_gcroot_dir}/${__nix_gcroot_prefix}-$(basename "${storepath}")"rm -f "${gcroot}"ln -s "${storepath}" "${gcroot}"if [ "${WRAP_NIX_MAKE_GCROOTS:-0}" = 1 ]; thenlocal -r storepath="${1}"echo "Preventing GC for '${storepath}'"local -r gcroot="${__nix_gcroot_dir}/${__nix_gcroot_prefix}-$(basename "${storepath}")"rm -f "${gcroot}"ln -s "${storepath}" "${gcroot}"fi - replacement in bash/nix-container-demo-helper.sh at line 58
if [ "${WRAP_NIX_MAKE_GCROOTS:-0}" = 0 ]; thencommand nix "$@"elselocal -r action=$1shiftlocal -r action=$1shift - replacement in bash/nix-container-demo-helper.sh at line 61
local nix_args=()local args=()local nix_args=()local args=() - replacement in bash/nix-container-demo-helper.sh at line 64
local __encountered_dashes=0while [ $# -gt 0 ]; doif [ "$1" == "--" ]; then__encountered_dashes=1elif [ "${__encountered_dashes}" = 1 ]; thenargs+=("$1")elsenix_args+=("$1")fishiftdonelocal __encountered_dashes=0while [ $# -gt 0 ]; doif [ "$1" == "--" ]; then__encountered_dashes=1elif [ "${__encountered_dashes}" = 1 ]; thenargs+=("$1")elsenix_args+=("$1")fishiftdone - replacement in bash/nix-container-demo-helper.sh at line 76
local storepathif [ "${action}" = run ]; thencommand nix run "${nix_args[@]}" -- "${args[@]}"for storepath in $(command nix build "${nix_args[@]}" --no-link --print-out-paths); do__nix_make_gcroot "${storepath}"doneelif [ "${action}" = build ]; thencommand nix build "${nix_args[@]}"for storepath in $(command nix build "${nix_args[@]}" --no-link --print-out-paths); do__nix_make_gcroot "${storepath}"doneelif [ "${action}" = develop ]; then# shellcheck disable=SC2016storepath="$(command nix develop "${nix_args[0]}" --command bash -c 'echo ${NIX_GCROOT}' 2>/dev/null)"local storepathif [ "${action}" = run ]; thencommand nix run "${nix_args[@]}" -- "${args[@]}"for storepath in $(command nix build "${nix_args[@]}" --no-link --print-out-paths); do - replacement in bash/nix-container-demo-helper.sh at line 81
command nix develop "${nix_args[@]}"doneelif [ "${action}" = build ]; thenif __libdemo_is_interactive && [ -e "$(nix eval --raw "${nix_args[0]}")" ]; thencommand nix build "${nix_args[@]}" --rebuild - replacement in bash/nix-container-demo-helper.sh at line 86
command nix "${action}" "${nix_args[@]}"command nix build "${nix_args[@]}" - edit in bash/nix-container-demo-helper.sh at line 88
for storepath in $(command nix build "${nix_args[@]}" --no-link --print-out-paths); do__nix_make_gcroot "${storepath}"doneelif [ "${action}" = develop ]; then# shellcheck disable=SC2016storepath="$(command nix develop "${nix_args[0]}" --command bash -c 'echo ${NIX_GCROOT}' 2>/dev/null)"__nix_make_gcroot "${storepath}"command nix develop "${nix_args[@]}"elsecommand nix "${action}" "${nix_args[@]}" - edit in 07-vm-integration-test/demo.sh at line 40
n "Force a rebuild so we can see what is happening"i nix build "${dir}" -L --rebuild - edit in 03-nix-container/demo.sh at line 14
x nix build "${dir}#container" -L -o "${dir}/result-container", "Let's rebuild so we can see what happened..." - replacement in 03-nix-container/demo.sh at line 15
i nix build "${dir}#container" -L -o "${dir}/result-container --rebuild"x nix build "${dir}#container" -L -o "${dir}/result-container" - edit in 02-nix-build/demo.sh at line 34
n "If the package was already built and put into the Nix store before this would normally be a no-op,", "but for the purposes of an interactive demo we will rebuild it, so we can see what happens." - edit in 02-nix-build/demo.sh at line 39[5.516]→[5.4683:4850](∅→∅),[5.4850]→[2.116:150](∅→∅),[2.150]→[5.673:674](∅→∅),[5.611]→[5.673:674](∅→∅),[5.673]→[5.673:674](∅→∅)
h "Maybe there was no output; this means that package was already built and put into the Nix store", "Let's build it again so we can see what happens under the hood"i nix build "${dir}" -L --rebuild