dotfiles.nix/install.sh

23 lines
519 B
Bash
Executable File

#!/usr/bin/env bash
dest=$1
machine=$HOSTNAME
if [[ -z "$dest" ]]; then
dest="/etc/nixos/configuration.nix"
fi
if [[ -z "$machine" ]]; then
machine=default-name
fi
if [[ ! -d "machines/$machine" || ! -f "machines/$machine/configuration.nix" ]]; then
echo "$machine is not a known machine"
echo "Run as \`env HOSTNAME=<MACHINE> ./install.sh\` to override."
exit
else
echo "Linking ./machines/$machine/configuration.nix to $dest"
fi
sudo ln -sf $PWD/machines/$machine/configuration.nix $dest