- Install nix using unofficial nix installer.
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install- Create
/rundirectory asnix-darwinneeds it.
printf 'run\tprivate/var/run\n' | sudo tee -a /etc/synthetic.conf
/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t- Install homebrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"- Build and apply your configuration.
nix build .#darwinConfigurations.arifvn.system
./result/sw/bin/darwin-rebuild switch --flake .#arifvn- Switch configuration.
drs(to build and switch your configuration)psc(to build and cache your configuration)
nix build .#homeConfigurations.arifvn.activationPackage
./result/activatewarning: failed to execute apfs.util. If you encountered it, you might have needed to restart your machine.warning: can't link /etc/shellsorwarning can't link /etc/nix/nix.conf. You might get them saying that files under/etccan't be linked as they already exist. You'll need to delete those files and rundarwin-rebuild switchagain. It'd be good if you had those files backed up first, just in case.
sudo cp /etc/shells /etc/shells.bak && sudo rm /etc/shells
sudo cp /etc/bashrc /etc/bashrc.bak && sudo rm /etc/bashrc
sudo cp /etc/nix/nix.conf /etc/nix/nix.conf.bak
nix build .#darwinConfigurations.arifvn.system --extra-experimental-features nix-command --extra-experimental-features flakes
./result/sw/bin/darwin-rebuild switch --flake .#arifvn-
command not found: darwin-rebuild. Are nix anddarwin-rebuildavailable in your shell if you open a new terminal and runexec /run/current-system/sw/bin/fish? If so, you might need to runchshto set the default shell that terminal emulators on your system will use. Try runningchsh -s /run/current-system/sw/bin/fishto set Fish as your default shell. -
Some system settings like Dock settings or Finder settings might only take effects after you reboot your machine.
-
Some apps might need to be configured mannually afterward as they don't come up with configuration files including
android-studio,istat-menusandraycast.
✅ None. It hasn't been found yet.
Usefull nix config repos (very much inspire this repo) :
Nix builtin functions:
- inherit
- attrValues
- singleton
- makeOverridable
- lib.options
- attrsets.optionalAttrs
- lib.mkMerge
- config argument
Tutorials:
- Declarative macOS Configuration Using nix-darwin And home-manager
- An unofficial, opinionated, gentle introduction to Nix
- Setup home-manager for standalone use on Macos
- Setup nix-darwin/home-manager from scratch
- Darwin Manual
- Some Issues and Discussions about this original repo
- How to uninstall nix on MacOS