-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
nixFlakes: enable flakes #120141
nixFlakes: enable flakes #120141
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be a postInstall script instead of a wrapper because tools access the version of nixFlakes.
Thanks. I wanted to prevent a rebuild, but that obviously makes no sense. |
I think we should remove the Maybe a case could be made for having a |
The nixFlakes attribute is already mentioned in a lot of blog posts etc. For people who want to try flakes, removing the nixFlakes attribute would downgrade the UX even more.
Whatever name we give this attribute, I would love to see a nix + flakes version that just works. Currently nix + flakes throws us back to the |
It would be an alias to nixUnstable which would work for almost anyone.
That would break at least nix search for people who avoid flakes because they are still using channels or niv. I am required to use nixUnstable because of NixOS/nix#4664 but using flakes for doing development is a pain and using yet another lock file is also not great. |
I don't follow - why would enabling experimental features break anything? |
On old versions of $ command nix search hello
warning: using cached results; pass '-u' to update the cache
* nixpkgs.gnome3.iagno (iagno-3.38.1)
Computer version of the game Reversi, more popularly called Othello
* nixpkgs.hello (hello)
A program that produces a familiar, friendly greeting
* nixpkgs.hello-unfree (example-unfree-package-1.0)
An example package with unfree license (for testing)
* nixpkgs.hello-wayland (hello-wayland-unstable)
Hello world Wayland client
* nixpkgs.javaPackages.mavenHello_1_0 (maven-hello)
Maven Hello World
* nixpkgs.javaPackages.mavenHello_1_1 (maven-hello)
Maven Hello World When you do the same with newer versions you get one of these errors: $ NIX_CONFIG="experimental-features =" command nix search hello
error: experimental Nix feature 'nix-command' is disabled; use '--experimental-features nix-command' to override $ NIX_CONFIG="experimental-features = nix-command" command nix search hello
error: experimental Nix feature 'flakes' is disabled; use '--experimental-features flakes' to override $ NIX_CONFIG="experimental-features = nix-command flakes" command nix search hello
error: cannot find flake 'flake:hello' in the flake registries $ NIX_CONFIG="experimental-features = nix-command flakes" command nix search #hello
...
all packages that are searchable
... $ NIX_CONFIG="experimental-features = nix-command flakes" command nix search nixpkgs#hello
* legacyPackages.x86_64-linux.hello (2.10)
A program that produces a familiar, friendly greeting Only way I found to get the old behavior back is So I think that enabling experimental-features for nixUnstable by default is not really an option. |
@SuperSandro2000 I think there was no intention to enable experimental features for Considering all concerns that have been expressed in this thread so far, what do you guys think about the following?:
We could make |
be755f0
to
8865881
Compare
I haven't heard back from you guys. I now implemented it like proposed in my last comment. |
I really like this proposal. I think its great UX for a user to be able to get into a shell with flakes completely ready. |
I'm not happy about this change and I think we should revert it. Usage of the Also, upstream Nix doesn't provide a "enable all experimental features" patch so neither should Nixpkgs. |
I think, this ought to be rephrased into:
In reality, people that want to use it only had been bothered by a very bad UX to enable it. But, as a matter of fact, it's not unstable / experimental enough so that they wouldn't want to use it. It seems that the meaning of the word "experimental" has already been eroded and diluted over the eons of times. Now, overall, that's probably the bigger issue. I'm not asked here to propose solutions, so I'm better not going to until I am. |
I think what edolstra is referring to by the term experimental is not that the feature in it's current state is unreliable, but the fact that the feature is still subject to change. For example there are still discussions going on about changing the output format of flake.nix. Thinking about that, I can understand that it would be very undesirable if someone accidentally starts depending on flakes without knowing this. |
I agree, a CLI warning that an experimental feature is being used would ensure that no user is lead into false assumptions. I guess one can see in So does "revert |
@DavHau Yes, exactly. Experimental doesn't mean unusable.
Is it very bad UX? You add a line to a configuration file or set a flag on the command line. This seems pretty similar to how you enable experimental features in rustc, for instance.
That's possible, but warnings would be annoyingly spammy. I don't have to be reminded on every invocation that I enabled an experimental feature. |
Usage of the nixFlakes attribute obscures the fact that it's an experimental feature. Providing a nixExperimental attribute (which people will inevitably start using on their production machines) makes it too easy to enable all experimental features, when you should explicitly opt in to the features that you want to try out. Also, upstream Nix doesn't provide an "enable all experimental features" patch so neither should Nixpkgs.
The bad UX that I mean is really in that there are a perceived 10.000 different ways of enabling this at 10.000 different points.
in
One has to do that every time, and it often times is nothing more than a cause for frustration. So at least the |
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
This reverts commit 21bfd3b.
Motivation for this change
I assume everyone who installs
nixFlakes
wants to use the flakes feature.It is an unnecessary complication to have to edit the nix.conf or set config options via environment variables.
This makes it harder to instruct other people on how to install nix with flakes.
It also makes it harder to ship nix + flakes in a shell environment.
If someone really wants to have an unstable nix without flakes enabled, they can still refer to
nixUnstable
.Things done
wrap nixFlakes to set
NIX_CONFIG="experimental-features = nix-command flakes"
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)