add install-host.sh

This commit is contained in:
Astro 2019-02-11 01:40:26 +01:00
parent 4b00bcaced
commit bca2d108cb
1 changed files with 21 additions and 0 deletions

21
install-host.sh Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e
REPO=nix-configs
if [ -d $REPO ]; then
cd $REPO
git pull --ff-only
else
git clone https://github.com/c3d2/$REPO.git $REPO
fi
for OLDCFG in /etc/nixos/{hardware-,}configuration.nix; do
if [ -f $OLDCFG ]; then
sudo mv ${OLDCFG}{,.old}
fi
done
sudo ln -s $HOME/$REPO/hosts/`hostname -s`/configuration.nix /etc/nixos/configuration.nix
ls -l /etc/nixos/configuration.nix