24 lines
480 B
Bash
Executable file
24 lines
480 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
source .env
|
|
|
|
script="$(mktemp)"
|
|
files="$(mktemp)"
|
|
result="$(mktemp -d)"
|
|
|
|
git ls-files > "$files"
|
|
|
|
trap 'rm -f "$script" "$files"; rm -rf "$result"' EXIT
|
|
|
|
cat > "$script" << EOF
|
|
if nix build -f system.nix -o "$result/out"; then
|
|
[ "$LIBVIRT_DOMAIN" ] && virsh reset $LIBVIRT_DOMAIN
|
|
"$result/out/bin/pixiecore"
|
|
else
|
|
echo "Build failed" >&2
|
|
exit 1
|
|
fi
|
|
EOF
|
|
chmod +x "$script"
|
|
|
|
watchexec -w . -r --filter-file "$files" -- "$script"
|