helm/deploy

21 lines
667 B
Plaintext
Raw Normal View History

2019-08-06 10:56:54 -07:00
#!/usr/bin/env bash
DOTFILES="$(cd $(dirname "${BASH_SOURCE:-${(%):-%x}}") && pwd -P)"
PREFIX="${PREFIX:-/mnt/etc/nixos}"
HOST=${1:-${HOST:-kuro}}
set -e
if [[ ! -f "$DOTFILES/configuration.$HOST.nix" ]]; then
>&2 echo "No configuration exists for host '$HOST'"
exit 2
fi
2019-08-06 10:56:54 -07:00
mkdir -p "$PREFIX"
sudo ln -sf "$DOTFILES/configuration.$HOST.nix" "$PREFIX/configuration.nix"
2019-08-06 10:56:54 -07:00
sudo nix-channel --add https://nixos.org/channels/nixos-19.03 nixos
sudo nix-channel --add https://github.com/rycee/home-manager/archive/master.tar.gz home-manager
sudo nix-channel --update
2019-08-06 10:56:54 -07:00
sudo nixos-generate-config --root "$PREFIX"
sudo nixos-install --root "$PREFIX" -I "config=$DOTFILES"