-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
flake: drop most external inputs & improve packaging #687
Conversation
Previously, inputs like Crane and Fenix were used to only build the `niri` package. This isn't really required, and can easily be replaced by nixpkgs' `rustPlatform` -- which will also lead to less dependencies being pulled into user's lockfiles
9dbd186
to
1611d4d
Compare
cc @sodiboo |
i'll be honest, the flake was kind of a mess, thank you for cleaning it up. I'm not convinced all of this is necessary as this flake is mainly for niri development on NixOS (for end-users, One of the commit messages says:
And I do notice that some of the dependencies removed are... Not Unnecessary. As-is, this pull request breaks Switching from
I postulate that this was leveraged here. Fenix was used to provide a nightly toolchain in the dev shell, which is not a huge deal (niri isn't a nightly-only package), except for the fact that niri uses Nightly
rustfmt ? |
Yeah, visual tests should definitely keep working on the development flake. |
I think |
I strongly disagree. I much prefer working with flakes, and if people wish to consume it through |
Yeah, this was the original plan here. I had the idea to try out Niri but wanted to clean this up a bit first before pulling it into my personal monorepo, then hopefully get it into nixpkgs.
In the context of the package output of this flake, I believe I'm still right. Running a quick test in the basic
This I didn't account for though -- as I'm not really familiar with the development of this project and assumed if the
100%!
Another case of me not being very familiar with development here 😆 Fenix will definitely have to come back for this, but I'm not completely sure how. Since this is a (single) development tool, I would rather not have end user's flake.lock get stuck with it. We could use it with
The latter here would allow for consumers of this flake (including |
I can agree this would be nicer (especially since it wouldn't require always downloading upstream's Nix revision and needing to deal with
In the end, either stable Nix users or flake users will have a lesser experience here. There's no good solution that doesn't hurt either, and for the sake of maintenance (and the fact that literally all users of the Nix code in this repository have been doing so via a flake up until this point), keeping flake.nix as the single "source of truth" and leveraging flake-compat is probably the best option |
Isn't this just exactly the main thing that |
Yes, but it is quite limited (see the comment at the end) and this functionality isn't exposed at all |
I would rather have the dev shell use all nightly fenix tooling, I don't see why this would mean it's a hard requirement for the end user's flake lock. Can we not just provide a niri package output with a stable rustPlatform, while using an unstable rustPlatform for the dev shell? in any case, i don't actually see making fenix a hard requirement as a huge issue, because at least as of right now, this flake isn't for end users. It's for development, and developers would be using the fenix toolchain anyway. Why is it for developers? see below Something i forgot to bring up earlier, but this is important: The way the I don't actually know what's the best way around that really. What we've been doing is pretending it doesn't matter, because to my knowledge the primary consumers of this flake are just people working on niri from NixOS. The issue isn't as prevalent then, because development mostly happens through the winit backend, which doesn't have this problem. If i want to try the drm backend, it's generally just a Is that all coherent? Just to be clear, this is just my understanding of the purpose of this repo's flake. I don't mean this in a way as "Thou Shalt Not Make It End User Friendly"; it's just that. i think it already isn't end-user friendly due to the repo management structure (which shouldn't need to change to properly support nix; it should be the other way around that the nix parts can adapt to how niri is structured), and i don't see that changing any time soon. which isn't necessarily a bad thing, but it shapes how i think about this repo's flake and what it "ought to" accommodate and what it "oughtn't" accommodate. |
sidenote: i'm mostly sleep deprived as i wrote all of this. i wasn't like, falling asleep or anything, but i felt very Unfocused while writing it. it just felt weird and difficult to formulate stuff right now. i tried my best to be coherent, though. |
We can. I was just being a bit lazy with leveraging
Even if this flake isn't meant for end users, it may be consumed by flakes that are -- like niri-flake. Making Fenix a hard dependency here would in turn make it one there, which is even more troublesome as it's not possible to use the
I don't think this makes much of a difference? It's the same behavior as overriding the nixpkgs input, but without the advantages of pure attributes like evaluation caching and not creating multiple instances of nixpkgs (this is especially important in flakes meant to be consumed, like niri-flake again). It's fairly easy to re-use a flake's overlay in a package set though, so we can both
As long as overriding the
This isn't what the flake's
No worries! It was completely fine |
Some highlights include: - Removing some unnecessary dependencies of the package itself - Allowing for overriding the package - Adding Cargo feature toggles - Installing all niri-related resources - Avoiding `LD_LIBRARY_PATH` hacks
The (debug) package is already set as a check and will still be built with this, but Nix will now also check other outputs automatically -- such as the dev shell
1611d4d
to
6f846b9
Compare
An |
Yes, i know what the
Yes, because for basically all other projects, they will either have some obvious failure state, or they will straight up just Work. The only downside in 99% of applications is that it might cause a slightly larger system closure by duplicating deps, but here it poses a larger issue to the operating system's wider usability if niri is the only graphical session. Also note that I'm not convinced what I am suggesting here is the actual best way to go about it, but I do think you misunderstood what I was suggesting and why, which is why I tried to clarify what I actually meant.
This is nice, although the other reason I suggested to use a
Yay! Besides coming to some good consensus on how to deal with That Mesa Issue (and maybe some other bikeshedding matters; this is a Wayland compositor, after all), I do think it would probably be more or less okay to merge this now. Like, to be clear, none of those issues relating to mesa are introduced by this PR, so it may be best to solve at a different time, and submit another PR with the final change to mitigate it best we can. With the dev shell properly working again and supporting the relevant workflow (nightly toolchain, visual tests), this PR is unambiguously just improving the flake now. I still want to give it a proper review later, as I think there might be some other minor tweaks to do.
I was going to ask "wait, what? why can't we use Fenix? it worked fine before" but I read the issue you linked and immediately upon seeing |
Why is there a new default.nix file btw? I'm not a terribly big fan of adding more of these auxiliary files to the root directory of the repo |
When you A lot of the Nix ecosystem uses flakes as their primary dependency management solution, but flakes are technically not "stable". They are not enabled by default on new Nix installations, and require manually setting a feature flag before you're allowed to make use of them. This repo has previously pretended flakes are always available, which in practice they almost always are because flakes aren't actually unstable, their "experimental" label is mostly a result of bureaucracy and bikeshedding.
The It's also worth noting that this
I'm also not a fan of adding such files to the repo root, but from a Nix point of view it does make sense, which is why i didn't at all comment on it. However, it's not clear to me that there's... literally anyone... who actually needs this functionality, and adding a |
Thanks for the explanation. Let's remove default.nix since it's not important enough. |
Overlays aren't exactly hard to misuse either. For example, you said it could be consumed with
I would strongly recommend against implementing an API for this reason. niri-flake should not be considered as the only consumer, and this dogfooding makes very little sense in any other context
Unless you can guarantee the previous overlay is applied before yours, no. If you can, this will happen automatically and further overrides can be accessed I actually think this is a good argument for adopting the {
nixpkgs.overlays = [ inputs.niri.overlays.niri ];
} in their configuration with {
inputs.nixpkgs.follows = "nixpkgs";
} in flake.nix This definitley more of a niri-flake conversation though, so I'll end it here 😆
rust-overlay's tarball is a fair bit bigger since they archive many more versions of the nightly toolchain. The flake interface is also technically not stable, but (similar to flakes themselves) there haven't been any major breakages to my knowledge
So yeah, pretty much lol |
This allows `niri-visual-tests` to still be built and run in the dev shell where it's necessary, as well as brings back the nightly `rustfmt` used by the project We can't use `fenix` again though as it doesn't wrap `ld` like nixpkgs and rust-overlay do; without it, the way we link `dlopen()`'d libraries breaks
6f846b9
to
7667fb2
Compare
Thanks |
The primary goals of this are to make this flake
Easier to consume
niri
is now overridableFollow community best practices
callPackage
is used for the package expression, making it much easier to share code between here, nixpkgs, and anywhere elsealejandra
has been replaced withnixfmt-rfc-style
, the now standard formatter of Nix codeautoPatchelfHook
is dropped in favor of forcing linkage throughld
arguments where neededpassthru.providedSessions
is now providedSee commit messages for more context