mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-13 20:30:02 +00:00
installer: ensure /etc/static runs last
In the case that nix-darwin was installed for a single user installation and later nix gets reinstalled with the daemon it's possible that nix-daemon.sh loads afterwards, resulting in unexpected behaviour.
This commit is contained in:
parent
465539ad1d
commit
75cab75c22
2 changed files with 7 additions and 3 deletions
|
@ -25,23 +25,25 @@ with lib;
|
|||
esac
|
||||
fi
|
||||
|
||||
if ! test -L /etc/bashrc && ! grep -q /etc/static/bashrc /etc/bashrc; then
|
||||
if ! test -L /etc/bashrc && ! tail -n1 /etc/bashrc | grep -q /etc/static/bashrc; then
|
||||
if test -t 1; then
|
||||
read -p "Would you like to load darwin configuration in /etc/bashrc? [y/n] " i
|
||||
fi
|
||||
case "$i" in
|
||||
y|Y)
|
||||
sudo ${pkgs.gnused}/bin/sed -i '\,/etc/static/bashrc,d' /etc/bashrc
|
||||
echo 'if test -e /etc/static/bashrc; then . /etc/static/bashrc; fi' | sudo tee -a /etc/bashrc
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if ! test -L /etc/zshrc && ! grep -q /etc/static/zshrc /etc/zshrc; then
|
||||
if ! test -L /etc/zshrc && ! tail -n1 /etc/zshrc | grep -q /etc/static/zshrc; then
|
||||
if test -t 1; then
|
||||
read -p "Would you like to load darwin configuration in /etc/zshrc? [y/n] " i
|
||||
fi
|
||||
case "$i" in
|
||||
y|Y)
|
||||
sudo ${pkgs.gnused}/bin/sed -i '\,/etc/static/zshrc,d' /etc/zshrc
|
||||
echo 'if test -e /etc/static/zshrc; then . /etc/static/zshrc; fi' | sudo tee -a /etc/zshrc
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -109,7 +109,9 @@ stdenv.mkDerivation {
|
|||
echo >&2 "checking /etc"
|
||||
readlink /etc/static
|
||||
test -e /etc/static
|
||||
echo >&2 "checking /etc/static in bashrc"
|
||||
grep /etc/static/bashrc /etc/bashrc
|
||||
echo >&2 "checking /etc/static in zshrc"
|
||||
grep /etc/static/zshrc /etc/zshrc
|
||||
grep -v nix-daemon.sh /etc/profile
|
||||
echo >&2 "checking /run/current-system"
|
||||
|
@ -117,7 +119,7 @@ stdenv.mkDerivation {
|
|||
test -e /run
|
||||
readlink /run/current-system
|
||||
test -e /run/current-system
|
||||
echo >&2 "checking profile"
|
||||
echo >&2 "checking system profile"
|
||||
readlink /nix/var/nix/profiles/system
|
||||
test -e /nix/var/nix/profiles/system
|
||||
echo >&2 ok
|
||||
|
|
Loading…
Add table
Reference in a new issue