hm-switch: also aggressively manage nix.conf for non-nixos installs
parent
19b9a0713e
commit
8b1503c4bd
|
@ -7,6 +7,16 @@ echo "SCRIPT_DIR: ${SCRIPT_DIR}"
|
||||||
|
|
||||||
HOME_MANAGER_DIR="${SCRIPT_DIR}/../nix-conf/home-manager"
|
HOME_MANAGER_DIR="${SCRIPT_DIR}/../nix-conf/home-manager"
|
||||||
|
|
||||||
|
# Manage nix.conf. Ideally, this should be done with snapshot-based version
|
||||||
|
# and with preview on-the-spot, with some timeout
|
||||||
|
if [ -f /etc/nix/nix.conf ]; then
|
||||||
|
# managed nix.conf
|
||||||
|
BACKUP_FILE="/etc/nix/nix.conf.backup"
|
||||||
|
echo "overwriting /etc/nix/nix.conf. Please find latest backup in ${BACKUP_FILE}"
|
||||||
|
sudo cp /etc/nix/nix.conf ${BACKUP_FILE}
|
||||||
|
sudo cp "${HOME_MANAGER_DIR}/hwtr/nix.conf" /etc/nix/
|
||||||
|
fi
|
||||||
|
|
||||||
# Mason is bad: it puts binaries onto xdg.data
|
# Mason is bad: it puts binaries onto xdg.data
|
||||||
# let's make mason starts fresh, just in case we introduce RPATH hacks
|
# let's make mason starts fresh, just in case we introduce RPATH hacks
|
||||||
# that injects binary for Mason to use.
|
# that injects binary for Mason to use.
|
||||||
|
@ -15,7 +25,6 @@ rm -rf ~/.local/share/nvim/mason
|
||||||
# test if we have home-manager, if not, attempt to use nix to put home-manager to
|
# test if we have home-manager, if not, attempt to use nix to put home-manager to
|
||||||
# our environment
|
# our environment
|
||||||
if [ $(home-manager >/dev/null 2>&1) ]; then
|
if [ $(home-manager >/dev/null 2>&1) ]; then
|
||||||
# highly likely we don't even have nix support to start with, so let's fix that
|
|
||||||
nix-shell -p home-manager --run "home-manager switch --flake $HOME_MANAGER_DIR $@"
|
nix-shell -p home-manager --run "home-manager switch --flake $HOME_MANAGER_DIR $@"
|
||||||
else
|
else
|
||||||
home-manager switch -b backup --flake "$HOME_MANAGER_DIR" $@
|
home-manager switch -b backup --flake "$HOME_MANAGER_DIR" $@
|
||||||
|
|
Loading…
Reference in New Issue