From c3b406bd1c6e60a69996dbbd529328e40d298bd7 Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Tue, 5 Nov 2024 02:31:26 +1100 Subject: [PATCH] uninstaller: restore `*.before-nix-darwin` files Fixes https://github.com/LnL7/nix-darwin/issues/911 Fixes https://github.com/LnL7/nix-darwin/issues/912 --- pkgs/darwin-uninstaller/configuration.nix | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/pkgs/darwin-uninstaller/configuration.nix b/pkgs/darwin-uninstaller/configuration.nix index a2283d89..75d1cacf 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) ''; }