deploy: remove some unused code
This commit is contained in:
parent
49500df5f4
commit
bf79d354c5
62
bin/deploy
62
bin/deploy
@ -47,63 +47,6 @@ if [ "$1" = "watch" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "status" ]; then
|
||||
rev=$(git rev-parse HEAD)
|
||||
msg "Currently at: ${rev}\t($(git log --format=%B -n 1 $rev | head -n1))"
|
||||
for h in $(listNixOSHosts); do
|
||||
host="$(resolveAlias $h)"
|
||||
if ! tsAlive $host; then
|
||||
msg "can't reach ${h}.. skipping.."
|
||||
continue
|
||||
fi
|
||||
echo -n "===> $h: "
|
||||
host_data="$(${SSH} root@${host} 'xin-status')"
|
||||
remote_rev=$(echo $host_data | jq -r .configurationRevision)
|
||||
remote_ver=$(echo $host_data | jq -r .nixosVersion)
|
||||
needs_reboot=$(echo $host_data | jq -r .needs_restart)
|
||||
rev_msg="DIRTY"
|
||||
rev_status="✓"
|
||||
if [ "$remote_rev" != "DIRTY" ]; then
|
||||
rev_msg=$(git log --format=%B -n1 $remote_rev | head -n1)
|
||||
if [ "${remote_rev}" != "${rev}" ]; then
|
||||
rev_status="×"
|
||||
fi
|
||||
fi
|
||||
echo -en "\t\t${remote_ver}\t${rev_status}\t(${rev_msg})"
|
||||
if [ "$needs_reboot" == "false" ]; then
|
||||
echo -e "\tOK"
|
||||
else
|
||||
echo -e "\tREBOOT"
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "install" ]; then
|
||||
h="$2"
|
||||
host="$(resolveAlias $2)"
|
||||
dest="${3:-/nix/store}"
|
||||
shift
|
||||
shift
|
||||
|
||||
if [ ! -d hosts/${h} ]; then
|
||||
msg "No config found for $h"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -eu
|
||||
set -x
|
||||
mkdir -p .gcroots
|
||||
out=$(nix build -o .gcroots/${h} --json .#nixosConfigurations.${h}.config.system.build.toplevel | jq -r '.[0].outputs.out')
|
||||
|
||||
nix copy -s --to "ssh://root@${host}?remote-store=${dest}" "$out"
|
||||
nix copy -s --derivation --to "ssh://root@${host}?remote-store=${dest}" "$out"
|
||||
|
||||
${SSH} "root@${host}" NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root "$dest" -- nix --extra-experimental-features nix-command build --profile /nix/var/nix/profiles/system "$out"
|
||||
${SSH} "root@${host}" NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root "$dest" -- /run/current-system/bin/switch-to-configuration switch
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "local" ]; then
|
||||
sudo nixos-rebuild ${TRACE} --option eval-cache false --flake .#$(uname -n) switch 2>&1 | nom
|
||||
exit $?
|
||||
@ -130,11 +73,6 @@ if [ "$1" = "update" ]; then
|
||||
nix flake archive
|
||||
fi
|
||||
|
||||
if [ "$1" = "installer" ]; then
|
||||
nix build .#nixosConfigurations.isoInstall.config.system.build.isoImage
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if [ "$1" = "diff" ]; then
|
||||
host="$(resolveAlias $2)"
|
||||
mkdir -p .gcroots
|
||||
|
Loading…
Reference in New Issue
Block a user