1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-05 16:27:03 +00:00
nix-darwin/pkgs/darwin-uninstaller/configuration.nix

53 lines
1.7 KiB
Nix
Raw Normal View History

{ lib, ... }:
2018-01-15 01:12:26 +01:00
with lib;
{
# We are uninstalling, disable sanity checks.
assertions = mkForce [];
system.activationScripts.checks.text = mkForce "";
# Disable etc, launchd, ...
environment.etc = mkForce {};
launchd.agents = mkForce {};
launchd.daemons = mkForce {};
launchd.user.agents = mkForce {};
system.activationScripts.postUserActivation.text = mkAfter ''
2018-01-17 21:34:01 +01:00
if test -L ~/.nix-defexpr/channels/darwin; then
nix-channel --remove darwin || true
2018-01-17 21:34:01 +01:00
fi
2018-01-15 01:12:26 +01:00
'';
system.activationScripts.postActivation.text = mkAfter ''
if test -L /Applications/Nix\ Apps; then
rm /Applications/Nix\ Apps
fi
2018-01-15 22:31:50 +01:00
if test -L /etc/static; then
rm /etc/static
2018-01-15 01:12:26 +01:00
fi
2018-01-15 22:31:50 +01:00
if test -O /nix/store; then
if ! test -e /Library/LaunchDaemons/org.nixos.nix-daemon.plist; then
sudo rm /Library/LaunchDaemons/org.nixos.nix-daemon.plist || true
sudo launchctl remove org.nixos.nix-daemon 2> /dev/null || true
sudo cp /nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist /Library/LaunchDaemons/org.nixos.nix-daemon.plist
2018-01-15 22:31:50 +01:00
sudo launchctl load -w /Library/LaunchDaemons/org.nixos.nix-daemon.plist
fi
if ! grep -q etc/profile.d/nix-daemon.sh /etc/bashrc; then
echo >&2 "Found no nix-daemon.sh reference in /etc/bashrc"
echo >&2 "add this snippet back to /etc/bashrc:"
echo >&2
echo >&2 " # Nix"
echo >&2 " if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then"
echo >&2 " . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'"
echo >&2 " fi"
echo >&2 " # End Nix"
echo >&2
fi
2018-01-15 01:12:26 +01:00
fi
'';
}