Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"experimental feature 'ca-derivations' is disabled" even though it is enabled #4784

Closed
NobbZ opened this issue May 7, 2021 · 17 comments · Fixed by NixOS/nixpkgs#123246
Closed
Labels

Comments

@NobbZ
Copy link
Contributor

NobbZ commented May 7, 2021

Describe the bug

I wanted to try to rebuild the system in question using the new content addressable features, therefore I updated it to a recent stable release.

Whenever I try to build a CA enabled system config on that machine I get the following error:

$ nix build .\#nixosConfigurations.delly-nixos.config.system.build.toplevel
error: experimental Nix feature 'ca-derivations' is disabled; use '--experimental-features ca-derivations' to override
(use '--show-trace' to show detailed location information)

The error does not change, even if I provide --experimental-features 'ca-derivations flakes nix-command' on the CLI explicitely.

Also it is set in the nix.conf:

$ cat /etc/nix/nix.conf| grep experi
experimental-features = nix-command flakes ca-derivations ca-references

Building any CA enabled system config on one of my other systems works fine.

Steps To Reproduce

  1. Try to build any system with nixpkgs.config.contentAddressedByDefault = true; on the affected system.
  2. See it fail as described above

Expected behavior

A system configuration is built.

nix-env --version output

$ nix-env --version
nix-env (Nix) 2.4pre20210504_fe3a10a

Additional context

The system where the problem occurs is quite an old machine with an Intel Core2Duo CPU and only 4 GiB of RAM, though I wouldn't expect this to cause the actual error.

In general the configuration of my systems is available at https://github.com/NobbZ/nixos-config

The most relevant file for the affected system is probably https://github.com/NobbZ/nixos-config/blob/master/nixos/hosts/legacy/delly-nixos.nix

If any further details about this system or any other in my setup are required just ask.

Please be aware that I won't have physical access to the affected machine for the next couple of days, only SSH until VPN or WiFi decides to crash.

@NobbZ NobbZ added the bug label May 7, 2021
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/content-addressed-nix-call-for-testers/12881/53

@asymmetric
Copy link
Contributor

@NobbZ is there something relevant in your ~/.config/nix/nix.conf?

@NobbZ
Copy link
Contributor Author

NobbZ commented May 7, 2021

@asymmetric I do not have such a file.

@teto
Copy link
Member

teto commented May 15, 2021

I've just rebased on nixos-unstable and experiments something similar:

$ sudo nixos-rebuild --flake ~/home --no-write-lock-file --override-input nixpkgs-teto /home/teto/nixpkgs --override-input hm /home/teto/hm

building the system configuration...
error: experimental Nix feature 'flakes' is disabled; use '--experimental-features flakes' to override
error: getting status of '/tmp/nixos-rebuild.PjbHJF/result': No such file or directory

with ~/.config/nix/nix.conf
experimental-features = nix-command flakes

It used to work fine, I haven't changed anything relevant, I ran two switch in a row, first one succeeded, second failed with the previous error.

nix --version                                                                                                                                                                       ~/nixpkgs
nix (Nix) 2.4pre20210503_6d2553a

@teto
Copy link
Member

teto commented May 15, 2021

even stranger

 nix show-config | grep experimental 
experimental-features = nix-command flakes

@teto
Copy link
Member

teto commented May 15, 2021

(for anyone hitting this, I was able to work around it with https://discourse.nixos.org/t/how-to-do-a-flake-build-in-non-nixos-system/10450/7)

thufschmitt pushed a commit to thufschmitt/nixpkgs that referenced this issue May 16, 2021
Make sure that the Nix `experimental-features` set by a user aren’t overwritten when running `nixos-rebuild --flake` by using `--extra-experimental-features` rather than `--experimental-features`.

Fix NixOS/nix#4784
@thufschmitt
Copy link
Member

(for anyone hitting this, I was able to work around it with https://discourse.nixos.org/t/how-to-do-a-flake-build-in-non-nixos-system/10450/7)

Duuuuh, that explains everything! So what happens is that nixos-rebuild --flake sets --experimental-features (here), overriding whatever’s in the config file.

NixOS/nixpkgs#123246 should fix it

@NobbZ
Copy link
Contributor Author

NobbZ commented May 16, 2021

I did not use nixos-rebuild but directly build the corresponding attribute. The merged fix does not solve the reported problem. Can someone please re-open?

@thufschmitt
Copy link
Member

I did not use nixos-rebuild but directly build the corresponding attribute

Duh, I knew I’d missed something 🤦‍♂️

@thufschmitt
Copy link
Member

@NobbZ do you also have the error if you run nix build as root to bypass the Nix daemon?

@NobbZ
Copy link
Contributor Author

NobbZ commented May 17, 2021

Yes, I have, and I also have to add that the error happens for any __contentAddressed = true derivation that I try to build, not only system configuration.

@teto
Copy link
Member

teto commented Jun 7, 2021

I also still have the issue with
error: experimental Nix feature 'flakes' is disabled; use '--experimental-features flakes' to override with 2.4pre20210601_5985b8b even though flakes are enabled

nix show-config|grep flake                                                                                                                                                       
experimental-features = nix-command flakes
flake-registry = https://github.com/NixOS/flake-registry/raw/master/flake-registry.json

@kanashimia
Copy link
Member

nix show-config|grep flake                                                                                                                                                       
experimental-features = nix-command flakes
flake-registry = https://github.com/NixOS/flake-registry/raw/master/flake-registry.json

sudo nixos-rebuild

with ~/.config/nix/nix.conf

Do sudo nix show-config | grep flake (:
You change config of your user, and then use sudo to switch to a different user.

BTW here is an undocumented feature - you can pass --option experimental-features "nix-command flakes" to nixos-rebuild

@teto
Copy link
Member

teto commented Jun 8, 2021

good idea, I had checked /etc/nix/nix.conf which enabled flake and nix-command but I also had a file /root/.config/nix/nix.conf with just nix-command in it (I have no recollection of ever creating that file but well it exists). Removing the latter fixed the issue. Thanks for sharing the undocumented feature, it worked as well.

@asymmetric
Copy link
Contributor

BTW here is an undocumented feature - you can pass --option experimental-features "nix-command flakes" to nixos-rebuild

TBF, the nixos-manpage doe say

   In addition, nixos-rebuild accepts various Nix-related flags, including --max-jobs / -j,
   --show-trace, --keep-failed, --keep-going, --impure, and --verbose / -v. See the Nix manual for
   details.

Wether this si sufficient as (indirect) documentaion though, I'm not so sure :)

@kanashimia
Copy link
Member

Wether this si sufficient as (indirect) documentaion though, I'm not so sure :)

Note that nixos-rebuild only supports some very specific options of nix, basically the only way to know is by reading the source code.

@klarkc
Copy link

klarkc commented Mar 13, 2023

@NobbZ It's probably better to open a new issue and reference this one. Otherwise, it may go unnoticed by the maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants