configurations of hq services

install-host.sh 562B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env bash
  2. set -e
  3. REPO=nix-configs
  4. if [ -d $REPO ]; then
  5. cd $REPO
  6. git pull --ff-only
  7. else
  8. git clone https://github.com/c3d2/$REPO.git $REPO
  9. fi
  10. for OLDCFG in /etc/nixos/{hardware-,}configuration.nix; do
  11. if [ -f $OLDCFG ]; then
  12. sudo mv ${OLDCFG}{,.old}
  13. fi
  14. done
  15. sudo ln -s $HOME/$REPO/hosts/`hostname -s`/configuration.nix /etc/nixos/configuration.nix
  16. ls -l /etc/nixos/configuration.nix
  17. if [ -f $REPO/hosts/`hostname -s`/home.nix ]; then
  18. mkdir -p ~/.config/nixpkgs
  19. ln -s $HOME/$REPO/hosts/`hostname -s`/home.nix ~/.config/nixpkgs/home.nix
  20. fi