Catalina, Nix, and build failures

Nix is a powerful tool to manage packages and create reproducable builds. It also expects /nix on the filesystem to be writable, but starting with macOS Catalina that is no longer the case. But there’s a workaround Create an APFS volume and mount as /nix.

Unfortunately, you might still run into this error:

building '/nix/store/5lrbhhcipg6jjj6rn1kkvn2614jmf5fg-source.drv'...

trying https://github.com/darlinghq/darling/archive/d2cc5fa748003aaa70ad4180fff0a9a85dc65e9b.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   159  100   159    0     0    159      0  0:00:01 --:--:--  0:00:01   368
100 12.5M  100 12.5M    0     0  1431k      0  0:00:09  0:00:09 --:--:-- 1752k
hash mismatch in fixed-output derivation '/nix/store/f5c24j2dg02zb4386vyrw40hj6v1c051-source':
  wanted: sha256:11b51fw47nl505h63bgx5kqiyhf3glhp1q6jkpb6nqfislnzzkrf
  got:    sha256:0krlrb75fcfa52kx1nvlpyxk060zk2931hfw6g86k5nmzfv9hyxa
cannot build derivation '/nix/store/965ryj5ypzwplvyg8gg37rq63ap53h4s-Libsystem-osx-10.12.6.drv': 1 dependencies couldn't be built
building '/nix/store/96ilwn5cvk7qzi5whmcypr4rqbi448nk-source.drv'...

Nix has may long-standing issues with case-sensitivity and macOS.

Remake the APFS “Nix” volume as case-insensitive.