2024-11-05 02:31:26 +11:00
|
|
|
{ lib, pkgs, ... }:
|
2018-01-15 01:12:26 +01:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
# We are uninstalling, disable sanity checks.
|
|
|
|
assertions = mkForce [];
|
|
|
|
system.activationScripts.checks.text = mkForce "";
|
|
|
|
|
|
|
|
environment.etc = mkForce {};
|
|
|
|
launchd.agents = mkForce {};
|
|
|
|
launchd.daemons = mkForce {};
|
|
|
|
launchd.user.agents = mkForce {};
|
|
|
|
|
2025-01-28 18:40:29 +00:00
|
|
|
# Restore any unmanaged `nix-daemon`.
|
|
|
|
nix.enable = false;
|
2024-11-11 23:05:03 +11:00
|
|
|
|
2018-01-15 01:12:26 +01:00
|
|
|
system.activationScripts.postUserActivation.text = mkAfter ''
|
2025-01-13 23:21:04 +00:00
|
|
|
nix-channel --remove darwin || true
|
2018-01-15 01:12:26 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
system.activationScripts.postActivation.text = mkAfter ''
|
2025-01-13 23:21:04 +00:00
|
|
|
nix-channel --remove darwin || true
|
|
|
|
|
2024-11-05 01:14:16 +11:00
|
|
|
if [[ -L /Applications/Nix\ Apps ]]; then
|
2023-07-12 18:56:13 +10:00
|
|
|
rm /Applications/Nix\ Apps
|
|
|
|
fi
|
|
|
|
|
2024-11-05 01:14:16 +11:00
|
|
|
if [[ -L /etc/static ]]; then
|
2018-01-15 22:31:50 +01:00
|
|
|
rm /etc/static
|
2018-01-15 01:12:26 +01:00
|
|
|
fi
|
|
|
|
|
2024-11-05 01:52:34 +11:00
|
|
|
# grep will return 1 when no lines matched which makes this line fail with `set -eo pipefail`
|
|
|
|
dscl . -list /Users UserShell | { grep "\s/run/" || true; } | awk '{print $1}' | while read -r user; do
|
|
|
|
shell=$(dscl . -read /Users/"$user" UserShell)
|
|
|
|
if [[ "$shell" != */bin/zsh ]]; then
|
|
|
|
echo >&2 "warning: changing $user's shell from $shell to /bin/zsh"
|
|
|
|
fi
|
|
|
|
|
|
|
|
dscl . -create /Users/"$user" UserShell /bin/zsh
|
|
|
|
done
|
2024-11-05 02:31:26 +11:00
|
|
|
|
|
|
|
while IFS= read -r -d "" file; do
|
|
|
|
mv "$file" "''${file%.*}"
|
|
|
|
done < <(find /etc -name '*.before-nix-darwin' -follow -print0)
|
2018-01-15 01:12:26 +01:00
|
|
|
'';
|
|
|
|
}
|