-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Improve flakes installables ergonomics, avoid nixpkgs# part? #4438
Comments
This would be a breaking change, but I do believe that the impact will be minimal. Ideally this should just affect the use of the registry (i.e. |
The reasons why we didn't do this:
That's true today but might not be the case in a decentralized world where a lot of stuff isn't in nixpkgs. |
Okay, thanks for the clarification |
Allow omitting the flake ref part for |
I would really love to see how the community ends up using flakes. So I'm hoping that this UI is more open to discussion. For my own use case, I have a package set which is
In a decentralized world, would it probably be expected that each user has a 'personal flake' that is used most often? I'm thinking about a flake with inputs referring to many other flakes as dependencies, and containing a package set and/or a As for the ambiguity problem, from a UI point of view, I'd prefer if there's no special character, but I think we can also reuse |
That could be an option, but |
How about this, fairly self-explanatory and would be nice and convenient:
|
This thread is very interesting, I had a recent problem of setting a shell for testing where I had to write this:
or
for example.
I thought at some point that the
So my question is, is there a way to make it shorter? |
btw, you can shorten the name of nixpkgs with this command:
|
@Narice bash afaik should also support
|
🤔 These days im like:
:D |
Thanks @zseri! |
@edolstra would you consider reopening this issue if instead of using a single priviledged flake, we allow for an arbitrary list of flakes to create a flat package space as I mused here? I ask this because I have been personally using nix-dram for over a month now, and the interface is just a lot nicer to work with, especially when pulling in multiple packages to a shell. If we don't do this, we'll end up having to work around this with some magic derivation as already attempted in a nixpkgs pull. The advantage of doing this here instead of in a derivation is that completions work wonderfully, and it's just shorter and more intuitive. I mean I guess zseri's answer above isn't horrible, but nix-dram has the advantage of working with completion |
Maybe an alias completer is not the worst solution? For example, I found this, here: https://github.com/cykerway/complete-alias Maybe some tweaks are necesary, but @gytis-ivaskevicius 's suggestions might somehow work. This neither prefers one flake over others, nor does it incur in never-to-be clean conflict resolution on merging namespaces. The latter, specifically, might result in unexpected user behaviour and cannot be resolved. |
Yes, I agree, the UX of nix-dram is better. |
The problem with merging flakes into a flat namespace is that 1) it's ambiguous since multiple flakes can provide packages with the same name; and 2) it's inefficient since you have to evaluate all the flakes in the flat namespace. |
so what's the problem with nix-dram implementation as is? Looks like the original objection was that we didn't want to make nixpkgs special, but as it stands this is already solved since it allows you to set whichever flake you want as the default, either via the I dunno, at least for me, I don't see myself going back to the old UI any time soon, and I may not be the only one... |
The remaining problem (with a single default) I see is not a technical one, but one of strategy & direction: if we allow people to set their preferred flake officially within the In other words: people who have a default flake set, will eventually fight decentralization [in addition to all the existing headwind] because it goes against their (officially sanctioned) habits. |
As the author of nix-dram, and the original author of this feature request, I think the question I raised previously in this comment is more important than I thought: #4438 (comment)
nix-dram was developed under the assumption that the answer is 'yes' and works greatly with 'one personal everything flake'. This flake contains not only the package I knew I will be using, but also packages I might use but isn't already part of any config. These 'might use' packages are one It is also demonstrably not the case that everyone will have this workflow. For example, see this reddit comment: https://www.reddit.com/r/NixOS/comments/lbqsfg/comment/glvzhpe/ I'd love to hear about anyone's thoughts on this question, both answers and comments on the question itself. |
This is a very good point. Since reexporting nixpkgs from your NixOS system's flake with your custome overlays applied seems like a clean way to combine whichever packages you'd like into a default package space to search. I would consider it good practice for flake authors to provide both a package and a overlay for their flake packages, although this isn't always the case unfortunately. I understand the comment about needing to search multiple different nixpkgs, but I still think having one eval cached and quickly accessible nixpkgs is a great idea. This is a package manager after all, what should be the initial concern for a new user just trying to pull a package into a shell? Should it be the given package itself (like every other package manager in the world), or some abstract concept called "flakes" which they may not even fully grasp just yet? In terms of breaking decentralization, I think combining flake overlays as mentioned above largely addresses this, but I'm not so sure the original intention of flakes was to break up nixpkgs anyway. Even if it was, I doubt that would ever come to pass since there are quite a number of Nixers who are hugely in favour of the current monorepo workflow, and it does seem to fit rather nicely with the goal of providing a global package repository. For the sake of argument though, let's say nixpkgs is broken up. Individual flakes would still likely be accessible from a single global space somehow or another whether officially, or by some community effort, similar to how packages in Arch Linux are individual git repos, but they are still searchable and installable from a single package space. Anything else would just require too much overhead. |
I think the relevant generalizations (over
So the point of contention seems to be that the registry namespace cannot easily be flattened. This very fundamentally circles back to having a global namespace (as in nixpkgs) vs having flakes. I'd say, aliasing certain registry items to short commands would do the trick without letting the dragon in? |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/too-many-open-files-nix-error-cant-search-packages/16299/2 |
Could we consider reopening this if we reduced the scope a bit, and only allow nix to search the flake in the current directory for outputs if a flakeref is not matched? That would be more convenient for working on flake based projects, while avoiding the main concerns that got this closed in the first place. |
Is your feature request related to a problem? Please describe.
It's kind of annoying to keep typing
nixpkgs#
over and over in situations like:Especially considering that
#
is kinda hard to type.Describe the solution you'd like
I feel like this should just work:
To achieve this, I'm thinking about this scheme:
INSTALLABLE
does not contain eitherlooks like an attribute name like:
or#
foo.bar.baz
, resolve it to some default flake, like eitherflake:default#foo.bar.baz
orflake:nixpkgs#foo.bar.baz
I'm not sure if this is the intention, but I think I am going to use stuff under
nixpkgs#
far more than the various other flakes. When we do need other flakes, just put a#
after the flake name, i.e.foo#
still meansflake:foo
, and things likegithub:owner/repo
still means that flake.Describe alternatives you've considered
nixpkgs#
a shorter name: Still a bit hard to type, even if it's justn#
Additional context
The text was updated successfully, but these errors were encountered: