Created
December 12, 2021 06:39
-
-
Save cherryblossom000/bf74dc3034abb972800f44e41bdbf201 to your computer and use it in GitHub Desktop.
Reinstalling Nix + nix-darwin + home-manager on macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/NixOS/nix/issues/3261 | |
# sudo ln -sf /nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt /etc/ssl/certs/ca-certificates.crt | |
# https://discourse.nixos.org/t/nix-flake-and-fetcher-cache-v1-sqlite/8958 | |
# (local u="$(whoami); sudo chown "$u:users" ~/.cache/nix) | |
# https://github.com/numtide/nix-unstable-installer | |
sh <(curl -L https://github.com/numtide/nix-unstable-installer/releases/download/nix-2.5pre20211026_5667822/install) --daemon | |
nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs | |
# https://nix-community.github.io/home-manager/index.html#sec-install-nix-darwin-module | |
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager | |
nix-channel --update | |
# https://github.com/LnL7/nix-darwin | |
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer | |
./result/bin/darwin-installer | |
rm -r result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credits to | |
# https://github.com/NixOS/nix/issues/1402 | |
# https://github.com/NixOS/nix/issues/3900 | |
sudo launchctl bootout system /Library/LaunchDaemons/org.nixos.darwin-store.plist | |
sudo launchctl bootout system /Library/LaunchDaemons/org.nixos.nix-daemon.plist | |
sudo rm /Library/LaunchDaemons/org.nixos* | |
cp -r .nixpkgs .nixpkgs-bak | |
rm -r ~/.nix-{channels,defexpr,profile} | |
# If custom PAM modules for sudo were installed via Nix: | |
# https://support.apple.com/en-us/HT204012 | |
# open -a 'Directory Utility' | |
# Click the lock to make changes -> Edit -> Root User… | |
# su | |
# vim /etc/pam.d/sudo # delete nix module lines | |
for i in {1..32}; sudo dscl . -delete "/Users/_nixbld$i" | |
sudo dscl . -delete /groups/nixbld | |
sudo mv /etc/bash.bashrc.backup-before-nix /etc/bash.bashrc | |
sudo mv /etc/bashrc.backup-before-nix /etc/bashrc | |
sudo mv /etc/zshrc.backup-before-nix /etc/zshrc | |
sudo rm /etc/ssl/certs/ca-certificates.crt | |
sudo rm -r /etc/nix | |
sudo vifs # delete nix line | |
sudo vim /etc/synthetic.conf # delete nix line | |
# diskutil apfs deleteVolume disk1s7 | |
open -a 'Disk Utility' # delete Nix Store volume | |
# if that doesn't work force eject via Finder first | |
# open /nix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment