Files
matej.nix/justfile
2026-03-03 15:01:27 +01:00

60 lines
1.5 KiB
Makefile

[private]
default:
@just --list
# rebuild and switch
switch:
nixos-rebuild switch --flake . --sudo
# fetch flake inputs
sync:
nix flake prefetch-inputs
# update flake inputs
update:
nix flake update
# update flake inputs, rebuild and switch
bump: update switch
# update a package to latest version
update-package pkg:
bash packages/{{pkg}}/update.sh
# update all packages with update scripts
update-package-all:
@for script in packages/*/update.sh; do bash "$script"; done
# build all packages and hosts
build:
nix flake check
# build installation iso
iso:
nixos-rebuild build-image --image-variant iso-installer --flake .#live-iso
# garbage collect old generations
clean:
sudo nix-collect-garbage $(nix eval --raw -f ./nix.nix nix.gc.options)
# build sandbox VM image
sandbox-build arch:
#!/usr/bin/env bash
set -euo pipefail
if [ "{{arch}}" = "x86_64" ]; then
nixos-rebuild build-image --image-variant qemu --flake .#sandbox-x86_64
elif [ "{{arch}}" = "aarch64" ]; then
nixos-rebuild build-image --image-variant qemu-efi --flake .#sandbox-aarch64
else
echo "error: arch must be x86_64 or aarch64"; exit 1
fi
ln -sfn "$(readlink result)" "result-sandbox-{{arch}}"
# run sandbox VM
sandbox-run arch *ARGS:
bash dist/run.sh $(find -L result-sandbox-{{arch}} -name '*.qcow2' | head -1) {{ARGS}}
# ssh into running sandbox
sandbox-ssh:
ssh -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null sandbox@localhost