forked from Deuxfleurs/nixcfg
Split upgrade to separate script
This commit is contained in:
parent
7c4a96bc71
commit
3db6c9a535
2 changed files with 24 additions and 3 deletions
|
@ -19,9 +19,6 @@ for NIXHOST in $NIXHOSTLIST; do
|
||||||
|
|
||||||
echo "==== DOING $NIXHOST ===="
|
echo "==== DOING $NIXHOST ===="
|
||||||
|
|
||||||
echo "updating Nix channels"
|
|
||||||
ssh -F ssh_config $SSH_DEST sudo nix-channel --update
|
|
||||||
|
|
||||||
echo "generating NixOS config"
|
echo "generating NixOS config"
|
||||||
cat configuration.nix | ssh -F ssh_config $SSH_DEST sudo tee /etc/nixos/configuration.nix > /dev/null
|
cat configuration.nix | ssh -F ssh_config $SSH_DEST sudo tee /etc/nixos/configuration.nix > /dev/null
|
||||||
cat node/$NIXHOST.nix | ssh -F ssh_config $SSH_DEST sudo tee /etc/nixos/node.nix > /dev/null
|
cat node/$NIXHOST.nix | ssh -F ssh_config $SSH_DEST sudo tee /etc/nixos/node.nix > /dev/null
|
||||||
|
|
24
upgrade.sh
Executable file
24
upgrade.sh
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
cd $(dirname $0)
|
||||||
|
|
||||||
|
if [ -z "$@" ]; then
|
||||||
|
NIXHOSTLIST=$(ls node | grep -v '\.site\.')
|
||||||
|
else
|
||||||
|
NIXHOSTLIST="$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for NIXHOST in $NIXHOSTLIST; do
|
||||||
|
NIXHOST=${NIXHOST%.*}
|
||||||
|
|
||||||
|
if [ -z "$SSH_USER" ]; then
|
||||||
|
SSH_DEST=$NIXHOST
|
||||||
|
else
|
||||||
|
SSH_DEST=$SSH_USER@$NIXHOST
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "==== DOING $NIXHOST ===="
|
||||||
|
|
||||||
|
ssh -F ssh_config $SSH_DEST sudo nix-channel --update
|
||||||
|
ssh -F ssh_config $SSH_DEST sudo nixos-rebuild switch
|
||||||
|
done
|
Loading…
Reference in a new issue