- Install nix using unofficial nix installer.
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
- Create
/run
directory asnix-darwin
needs 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/activate
warning: failed to execute apfs.util
. If you encountered it, you might have needed to restart your machine.warning: can't link /etc/shells
orwarning can't link /etc/nix/nix.conf
. You might get them saying that files under/etc
can't be linked as they already exist. You'll need to delete those files and rundarwin-rebuild switch
again. 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-rebuild
available in your shell if you open a new terminal and runexec /run/current-system/sw/bin/fish
? If so, you might need to runchsh
to set the default shell that terminal emulators on your system will use. Try runningchsh -s /run/current-system/sw/bin/fish
to 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-menus
andraycast
.
✅ 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