dotfiles/nixos/up.sh
Cyryl Płotnicki a4b90ac45a refactoring
2020-05-19 18:10:36 +01:00

33 lines
967 B
Bash
Executable file

#!/usr/bin/env bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
DIR=`realpath "$DIR/../"`
if [[ -z $DIR ]]; then
echo "please set DIR"
exit 1
fi
HOST=`hostname`
DIR=`realpath $DIR`
echo "using $DIR as the top level directory"
cd $DIR
git submodule update --init --recursive
mkdir -p ~/.config/Code/User
ln -vfs "$DIR/.config/Code/User/settings.json" ~/.config/Code/User/settings.json
ln -vfs "$DIR/.config/Code/User/keybindings.json" ~/.config/Code/User/keybindings.json
mkdir -p ~/.local/share/applications
ln -vfs "$DIR/tools" ~/
ln -vsf "$DIR/nixos/boxes/$HOST/home.nix" ~/.config/nixpkgs/home.nix
sudo ln -vsf "$DIR/nixos/boxes/$HOST/configuration.nix" /etc/nixos/configuration.nix
echo "all links done"
sudo nix-channel --add https://nixos.org/channels/nixos-20.03 nixos
nix-channel --add https://github.com/rycee/home-manager/archive/release-20.03.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install