2023-03-03 21:42:29 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
git config --local core.hooksPath "$PWD"/.githooks
|
2023-03-07 23:56:50 +01:00
|
|
|
|
|
|
|
test -d .direnv || mkdir -p .direnv
|
|
|
|
now="$(date +%Y-%m-%d)"
|
|
|
|
if ! test -s .direnv/pull-date || test "$now" != "$(cat .direnv/pull-date)"; then
|
2023-03-11 15:59:56 +01:00
|
|
|
git pull --rebase --autostash
|
|
|
|
nix flake update
|
|
|
|
echo "$now" > .direnv/pull-date
|
2023-03-07 23:56:50 +01:00
|
|
|
fi
|
|
|
|
|
2023-03-11 15:59:56 +01:00
|
|
|
if command -v nixos-rebuild >/dev/null; then
|
|
|
|
use flake .#nomos-rebuild
|
2023-03-09 07:03:15 +01:00
|
|
|
elif ! command -v nixos-rebuild >/dev/null; then
|
2023-03-11 15:59:56 +01:00
|
|
|
use flake .#non-nixos
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -s .remote.toml; then
|
|
|
|
use flake .#remote
|
|
|
|
echo
|
|
|
|
echo "Current remote: $(remote-host)"
|
|
|
|
tomlq <.remote.toml '.hosts | to_entries[] | "remote-set \(.key+1) # -> \(.value.host)"' -r
|
|
|
|
echo
|
2023-03-03 02:24:07 +01:00
|
|
|
fi
|