Open mpscholten opened 2 years ago
Instead I expect nix to just run it's thing. I don't care that this feature is experimental, I just want nix to run the command I told it to run.
Just add experimental-features = flakes nix-command
to nix.conf
to always have it enabled.
Why does everything in nix needs to be so frustrating?
Because nix is not pure magic and can do everything perfect first try but the community is working on it one step at the time.
The best solution would be to remove the warning. I know what I'm doing, I don't need the program to stop me.
It will be, when the features are no longer experimental.
Thanks 👍
Just add experimental-features = flakes nix-command to nix.conf to always have it enabled.
It would be useful to have this hint in the error message itself.
Because nix is not pure magic and can do everything perfect first try but the community is working on it one step at the time.
👍 Sorry, I was very frustrated here. I hope my intent to improve nix is clear here as well :)
It will be, when the features are no longer experimental.
I understand these are experimental features, but what's the reason users need to opt in to use them? It feels like it just adds trouble to the workflow. Especially as these experimental nix features are now used more often.
I agree that the message should describe how to enable them (or at least include a link to a place that gives more context and explains how to enable them while also explaining why they're experimental.
Here's another example of this problem I just hit while building some haskell packages with nix-shell
: Nix specifically told me to run nix log ..
. I then tried to run nix log ..
and this failed with the same error.
Maybe if these features are still experimental and opt-in only, nix shouldn't suggest me to run that command. Or maybe nix should tell me to run nix log ... --extra-experimental-features nix-command
instead.
The current behaviour, something fails but nix gives me a hint, but then that hint also fails is definitely more frustrating than it needs to be :)
I wish there was a way to silence these warnings without creating a config file.
$ nix run nixpkgs#home-manager --extra-experimental-features 'flakes nix-command' -- --flake gitlab:Diti/nix-dtp switch
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
# And then nothing happens.
$ nix run nixpkgs#home-manager --extra-experimental-features 'flakes nix-command' -- --extra-experimental-features 'flakes nix-command' --flake gitlab:Diti/nix-dtp switch
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
error: experimental Nix feature 'nix-command' is disabled; use '--extra-experimental-features nix-command' to override
# And then correctly runs `nixpkgs#home-manager`: “Starting Home Manager activation”, etc.
You maybe want try to place the --extra-experimental-features between nix and the verb or right after the verb. When placing it after the flake ref it maybe doesn't work on older versions. For me on 2.24 it works with your example.
nix --extra-experimental-features run 'flakes nix-command' nixpkgs#home-manager -- --flake gitlab:Diti/nix-dtp --help
@SuperSandro2000 Thanks! It should start with nix run
on my machine, though, but placing the --extra-experimental-features
option before the flake string silences all errors.
I wish Nix’s error reporting wasn’t so terrible. I’d contribute to the efforts of writing better documentation and error messages, but I’m afraid the toolset itself doesn’t really allow it.
Anyway, thanks!
Is your feature request related to a problem? Please describe. I'm always frustrated when nix doesn't do anything when I use "experimental features" such as nix flake or nix develop.
I always get this error:
Instead I expect nix to just run it's thing. I don't care that this feature is experimental, I just want nix to run the command I told it to run. Why does everything in nix needs to be so frustrating?
Describe the solution you'd like
The best solution would be to remove the warning. I know what I'm doing, I don't need the program to stop me.
Another solution would be to better describe how to fix the problem. E.g. in my case I was checking out an internal repo used at my company which contained a
.envrc
file which uses the direnv nix flake integration. So in that case I cannot pass any parameters to nix, as the nix command is called by direnv itself.Describe alternatives you've considered
I've tried to get rid of this error a few times in the past when trying out
nix develop
. I never gotnix develop
working (the error message is not very helpful on NixOS as well) and just gave up.Additional context OS: macOS Monterey Nix version:
nix (Nix) 2.10.3