echo 'nix' | sudo tee -a \/etc\/synthetic.conf<\/code><\/pre>\n\n\n\nStep 2: reboot<\/h2>\n\n\n\n
We need to reboot to apply the change about synthetic.<\/p>\n\n\n\n
After reboot, you have \/nix created<\/p>\n\n\n\n
Step 3: creating a new volume<\/h2>\n\n\n\n
It’s the magic about APFS and attaches it to \/nix<\/p>\n\n\n\n
sudo diskutil apfs addVolume disk1 APFSX Nix -mountpoint \/nix<\/code><\/pre>\n\n\n\nI’m the owner of the new volume<\/p>\n\n\n\n
sudo diskutil enableOwnership \/nix<\/code><\/pre>\n\n\n\nWe hide \/nix and auto-mount the new volume to \/nix at boot<\/p>\n\n\n\n
echo \"LABEL=Nix \/nix apfs rw\" | sudo tee -a \/etc\/fstab<\/code><\/pre>\n\n\n\nDisable spotlight (indexing) on \/nix<\/p>\n\n\n\n
sudo mdutil -i off \/nix<\/code><\/pre>\n\n\n\nStep 4: install<\/h2>\n\n\n\ncurl -L https:\/\/nixos.org\/nix\/install | sh<\/code><\/pre>\n\n\n\nStep 5: user config<\/h2>\n\n\n\n
We can replace and standardize each nix-env -i pkg_name<\/code> with a config file: $HOME\/.config\/nixpkgs\/config.nix<\/code><\/p>\n\n\n\nAn example:<\/p>\n\n\n\n
{\n allowUnfree = true;\n\n packageOverrides = pkgs: with pkgs; {\n all = pkgs.buildEnv {\n name = \"all\";\n paths = [\n ansible\n ansible-lint\n cloc\n colordiff\n dos2unix\n ffmpeg-full\n htop\n httpie\n jq\n mtr\n pwgen\n silver-searcher\n tmux\n tree\n watch\n wget\n whois\n yq\n zsh\n zstd\n ];\n };\n };\n}<\/code><\/pre>\n\n\n\nAnd to apply this config file: nix-env -i all<\/code><\/p>\n\n\n\nStep 6: my alias to upgrade and clean the old version<\/h2>\n\n\n\nnixupgrade='nix-channel --update && nix-env -u && nix-collect-garbage -d'<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"Installing Nix on macOS Catalina isn’t hard if you know a little about APFS. I’m the only user on my MacBook Pro so I don’t install using daemon mode, you can easily custom it (last step).<\/p>\n","protected":false},"author":1,"featured_media":100,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"saved_in_kubio":false,"footnotes":""},"categories":[13],"tags":[27],"_links":{"self":[{"href":"http:\/\/10.42.0.68:8080\/wp-json\/wp\/v2\/posts\/184"}],"collection":[{"href":"http:\/\/10.42.0.68:8080\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/10.42.0.68:8080\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/10.42.0.68:8080\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/10.42.0.68:8080\/wp-json\/wp\/v2\/comments?post=184"}],"version-history":[{"count":1,"href":"http:\/\/10.42.0.68:8080\/wp-json\/wp\/v2\/posts\/184\/revisions"}],"predecessor-version":[{"id":185,"href":"http:\/\/10.42.0.68:8080\/wp-json\/wp\/v2\/posts\/184\/revisions\/185"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/10.42.0.68:8080\/wp-json\/wp\/v2\/media\/100"}],"wp:attachment":[{"href":"http:\/\/10.42.0.68:8080\/wp-json\/wp\/v2\/media?parent=184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/10.42.0.68:8080\/wp-json\/wp\/v2\/categories?post=184"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/10.42.0.68:8080\/wp-json\/wp\/v2\/tags?post=184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}