2022-12-03 00:01:48 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
# NOTE: Untested on case of no home-manager
|
|
|
|
set -xv
|
|
|
|
# Where this script located
|
|
|
|
SCRIPT_DIR=$(realpath $(dirname $0))
|
|
|
|
echo "SCRIPT_DIR: ${SCRIPT_DIR}"
|
|
|
|
|
|
|
|
HOME_MANAGER_DIR="${SCRIPT_DIR}/../nix-conf/home-manager"
|
|
|
|
|
2023-01-03 05:48:12 +00:00
|
|
|
# Mason is bad: it puts binaries onto xdg.data
|
|
|
|
rm -rf ~/.local/share/nvim/mason
|
|
|
|
|
2022-12-03 00:01:48 +00:00
|
|
|
# test if we have home-manager, if not, attempt to use nix to put home-manager to
|
|
|
|
# our environment
|
2022-12-08 21:00:53 +00:00
|
|
|
if [ $(home-manager >/dev/null 2>&1) ]; then
|
2023-01-12 18:04:56 +00:00
|
|
|
# highly likely we don't even have nix support to start with, so let's fix that
|
|
|
|
sudo mv /etc/
|
2022-12-03 00:01:48 +00:00
|
|
|
nix-shell -p home-manager --run "home-manager switch --flake $HOME_MANAGER_DIR"
|
|
|
|
else
|
2022-12-21 23:42:59 +00:00
|
|
|
home-manager switch -b backup --flake "$HOME_MANAGER_DIR"
|
2022-12-03 00:01:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|