diff --git a/Justfile b/Justfile index 8e4291a..e4588df 100755 --- a/Justfile +++ b/Justfile @@ -144,6 +144,43 @@ update-this-device rebuild-mode='switch': git commit -v ${outfile} -m "nix/os/devices/$(hostname -s): bump versions" +# Rebuild an offline system +rebuild-disk device: + #!/usr/bin/env bash + set -xe + + just -v disk-mount {{device}} + just -v disk-install {{device}} + just -v disk-umount {{device}} + +# Re-render the versions of the given offline system and reinstall it in offline-mode +update-disk dir: + #!/usr/bin/env bash + set -exuo pipefail + + dir={{dir}} + + template={{dir}}/versions.tmpl.nix + outfile={{dir}}/versions.nix + + if ! test -e ${template}; then + template="$(just _DEFAULT_VERSION_TMPL)" + fi + + esh -o ${outfile} ${template} + if ! test "$(git diff ${outfile})"; then + echo Already on latest versions + exit 0 + fi + + export SYSREBUILD_LOG=.{{dir}}_sysrebuild.log + just -v rebuild-disk {{dir}} || { + echo ERROR: Update of {{dir}} failed, reverting ${outfile}... + exit 1 + } + + git commit -v ${outfile} -m "${dir}: bump versions" + # Iterate on a qtile config by running it inside Xephyr. (un-/grab the mouse with Ctrl + Shift-L) hm-iterate-qtile: #!/usr/bin/env bash