summaryrefslogtreecommitdiff
path: root/pkgs
diff options
context:
space:
mode:
authorMichael Hoang <enzime@users.noreply.github.com>2024-11-05 02:31:26 +1100
committerMichael Hoang <enzime@users.noreply.github.com>2024-11-07 18:17:34 +1100
commitc3b406bd1c6e60a69996dbbd529328e40d298bd7 (patch)
treefd1abd3e7516c710832de030cc8793de506f4ed6 /pkgs
parent9cd45289c9200b5adf29ed4faaf8e00a8c06da9c (diff)
uninstaller: restore `*.before-nix-darwin` files
Fixes https://github.com/LnL7/nix-darwin/issues/911 Fixes https://github.com/LnL7/nix-darwin/issues/912
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/darwin-uninstaller/configuration.nix18
1 files changed, 5 insertions, 13 deletions
diff --git a/pkgs/darwin-uninstaller/configuration.nix b/pkgs/darwin-uninstaller/configuration.nix
index a2283d8..75d1cac 100644
--- a/pkgs/darwin-uninstaller/configuration.nix
+++ b/pkgs/darwin-uninstaller/configuration.nix
@@ -1,4 +1,4 @@
-{ lib, ... }:
+{ lib, pkgs, ... }:
with lib;
@@ -33,18 +33,6 @@ with lib;
sudo cp /nix/var/nix/profiles/default/Library/LaunchDaemons/org.nixos.nix-daemon.plist /Library/LaunchDaemons/org.nixos.nix-daemon.plist
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
fi
# grep will return 1 when no lines matched which makes this line fail with `set -eo pipefail`
@@ -56,5 +44,9 @@ with lib;
dscl . -create /Users/"$user" UserShell /bin/zsh
done
+
+ while IFS= read -r -d "" file; do
+ mv "$file" "''${file%.*}"
+ done < <(find /etc -name '*.before-nix-darwin' -follow -print0)
'';
}