-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
Fetch one of #19582
Fetch one of #19582
Conversation
Useful for binary releases
I don't like the use of strings like
|
I do like having a function that takes the multiple inputs and creates the |
@aneeshusa on the longer run I want this block to be separated in a different file that can easily be parsed and updated by a script. I think that would work best if that block was composed of data only. |
@zimbatm I wonder about having two components to your mechanism, one where we use requireFile / fetchurl / etc. directly (as @aneeshusa suggests,) and then an adapter to support the data-driven mechanism. This makes the simple case more obvious, and the complicated case a simpler addition. I think. |
since nix is lazy, whats wrong with just using it can even be part of the derivation and be accessible that way |
I think you are missing |
# | ||
# Example usage: | ||
# | ||
# fetchmulti stdenv.system { |
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.
fetchmulti
-> fetchOneOf
?
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.
thanks, fixed
My concern with wanting to split out "the fetcher" from the build stuff is that often they're fairly entangled and can't be updated independently of one another. A patch that applied to one version might not apply after the version gets updated, and a e.g., a workaround configure flag might be needed after updating. So in some sense, I don't see the part of a package expression fetching sources to be a fundamentally different flavor of thing than the rest of the package build expression. Splitting them out so a machine can update one without updating the other feels like it'll lead to weirdness. But I'll come around later in this comment 😄 I also don't really grok why NixON is a desirable format for things. In most of my projects I've moved away from JSON towards things like Nix and Jsonnet precisely because I wanted function calls, and I think more and more people are realizing that a good model for configuration is to have some facilities for abstraction built into the language. I think Nix is miles ahead of the competition here, and it seems weird to me to arbitrarily cut out function calls and then simulate them poorly in a JSON-with-a-different-syntax. Do you have some writing on why that's desirable over pure JSON or straight Nix? If your goal is to enable something like monitor.nixos.org to better update packages for us (and to run tentative builds with updates), I think that's a worthy one, but if we're defining NixON ourselves I'd probably just leave function calls in the spec, then write some manipulation functionality for Nix source files, and possibly use Sorry if I come across as overly negative but after a few years working with Ansible and CloudFormation and other horrible approximations of programing languages constrained to a JSON syntax, I have a negative reaction to the notion spreading. |
Thanks for the feedback @copumpkin. I am still mulling over what you said but I think you might be right, I approached the problem the wrong way around. First I need to build the tool that helps with the packages upgrades, I am just unsure on how to parse the nix expression to do in-place transformation of the AST tree right now (without messing with the formatting and comments). |
Well, I'm also possibly wrong so don't just take my word for it 😄 As far as manipulation of the AST goes, https://github.com/jwiegley/hnix might be helpful. Alternately, avoiding Nix AST manipulation altogether (since in some sense "the type is too damn big" and you might want a more explicit data model) an option might be to do something like your
But whichever way you go, I'd start with a hypothesis of what the whole "automatically managed version upgrades" story would look like so that the rest of us can think through whether we'd use it or not for our own packages. I'd also contrast it to what monitor is doing, or maybe outline how what you're doing builds on the monitor. I'm mostly trying to avoid (you, us) spending a lot of time/work on something that's currently fairly speculative and that would have a large effect on everyone's packages, without getting a few of the "Nix core thinkers" (@edolstra, @shlevy, @domenkozar, etc.) on the same page for what that would look like. It makes me really sad to see tons of good thinking/work go into speculative work that never gets merged because people can't agree on how it should work. |
I realize that my last two responses are sort of contradictory by the way. In the first one I was basically advocating Nix AST manipulation and in the second, I suggested not doing that. I think in my first reply, I was mostly reacting to NixON, and if it's going to be isomorphic to JSON, I'd probably just stick with JSON. I do think it can be nice to have an explicit "data model" for external sources we know how to update, especially if we can attach a notion of things to do when they change. For example, I'd love to be able to annotate a hack/workaround as being obviated by an upcoming release: "this patch/hack in the package expression goes away after 1.7.5" is currently expressed in human comments (if we're lucky). As another example, the data model can have nice ramifications for paranoid people wanting to check what sources their builds pull. Compare https://nixos.org/wiki/Download_all_sources, where we can predownload all the sources, but we can't easily track down where we got them from (which in many ways is more interesting from a reviewer's perspective). Your stuff could help with that, if done right. If your system could systematize that (or at least have a consistent vision for how it would systematize it, even if it's not implemented at first), it would make me incredibly happy. So I do see the value in coming up with an explicit data model for what it means to pull something in from the outside. |
Yeah I think the upgrade mechanism should work on a whole package or even distribution (eg: gnome) level. But I agree that it needs to be fleshed out. What I'll do for now in this PR is just keep the switching bits to make it easy to use nix-prefetch-url. |
@zimbatm sry for late reply. vacations got in the way :) firefox-bin: i think per locale we valid case we will also have with other binary sources. eg. openoffice/libreoffice/skype/... no everybody defaults to english. trying to setup things for my family (slovenian) i can see that we are missing some and i expect we will need to fix them in future. as for the NIXON. i dont really see the advantage of it over JSON. i actually see JSON as a format that every language can produce, while for NIXOS every language will have to create some sort of library. also JSON can be easily read by nix via the most time consuming part of implementing this is going to be many updating scripts that we need to write and i see that holding the real value. also one person will never be able to do it. for this i think we will need to change contributions guide and require that everybody that writes an update or new package also writes and update script. |
Thanks everyone for participating. Closing that discussion in favor of #20844 |
Motivation for this change
it's currently painful to update sha256s with multi-arch sources (binary packages). With fetchmulti it's possible to do
nix-prefetch-url . -A mypackage.src.all
and get all the hashes out.This is a continuation of #19540 with more packages converted.
@garbas firefox-bin is the biggest-one left that I could find. It has some heuristic to select the locale which we might consider removing?
@edolstra this PR only introduces the
fetchOneOf
since the previous PR had a bit of a mix of concerns.Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)