`ca-derivations` is disabled regardless of config on Mac OS (solved)

Sorry if this is a repost or already solved, I could not find the solution.

I am trying to use nix develop on a hello world flakes setup but I cannot get past this error. My example is a trivial one from some tutorial: https://github.com/justinwoo/nix-flakes-hello-world-etc/blob/0b4b8d2d5530a9d43ed7e47f0dcd027569ad3bdc/flake.nix

$ nix develop
error: experimental Nix feature 'ca-derivations' is disabled; use '--extra-experimental-features ca-derivations' to override

$ nix develop --extra-experimental-features ca-derivations
error: experimental Nix feature 'ca-derivations' is disabled; use '--extra-experimental-features ca-derivations' to override

I have ca-derivations enabled in my config, as far as I know:

$ nix show-config | grep experimental
experimental-features = ca-derivations flakes nix-command

$ head -n 1 ~/.config/nix/nix.conf
extra-experimental-features = nix-command flakes ca-derivations

Here is my nix version info:

$ nix --version
nix (Nix) 2.17.0

$ nix store ping
Store URL: daemon
Version: 2.17.0
Trusted: 1

Has this been already discussed and solved? I would like to be linked if so.

Thanks.

1 Like

Not sure about the feature flag since I haven’t tried it out. I do see Content-addressed derivation fails to build on aarch64-darwin · Issue #6065 · NixOS/nix · GitHub

I wonder if this is a flakes thing, since the examples there are defining this in flake. Maybe the feature flag would be working with traditional nix-build or nix-shell?

Edit: Also see this comment in an issue elsewhere:

The ca-derivations feature is unique in that it must be set in the Nix daemon, not just the client. This is because it changes the schema of the Nix database, requiring a restart of the daemon. The only reliable way to enable it is to add it to /etc/nix/nix.conf and restart the nix-daemon process.

3 Likes

Ah, it seems your additional comment is what I needed. I added this line to the file:

# /etc/nix/nix.conf
+ extra-experimental-features = nix-command flakes ca-derivations
build-users-group = nixbld
trusted-users = root myuser

Then I stopped the nix daemon with launchctl:

$ sudo launchctl stop org.nixos.nix-daemon

Then this seems to work fine.

bash $ nix develop
nix  $ which nixpkgs-fmt
/nix/store/6mac4w7g3d11chafyp4s53qncrrk0d7h-nixpkgs-fmt-1.3.0/bin/nixpkgs-fmt

Thanks

1 Like