Common pitfalls and solutions for issues I’ve run into while using NixOS and Nix-Darwin.
NixOS
Unfree software
To run unfree software on NixOS without installing it globally, we can use:
Darwin
We can check darwin specific nix options on MyNixOS.
Building Changes
On darwin, we don’t use nixos-rebuild
to apply changes, instead we use nix-darwin
to switch to a new configuration.
Tip
We can also use nh to do all this stuff but in a more user-friendly way.
Rust / C++ DevShell
Apple bundles a C++ toolchain with Xcode, which doesn’t behave well with Nix if we are using a different C++ compiler, such as gcc
or stdenv.cc
.
To resolve this, we can simply remove the conflicting compiler from our devShell definition.