nix.dev icon indicating copy to clipboard operation
nix.dev copied to clipboard

Patterns: patching upstream software

Open domenkozar opened this issue 4 years ago • 2 comments

https://twitter.com/amanjeev/status/1333419722768048129

domenkozar avatar Nov 30 '20 15:11 domenkozar

Thanks for adding this issue. Here is something a bit more elaborate that might help for a newbie like me faces with Nix

Patching upstream or helping with patching/updating upstream (Nixpkgs only, I have not even graduated here so not gonna talk about NixOS)

This is very clear in itself because not only do I want to update something but also help upstream get the benefit of the upgrade and help the community. I have not been able to do that for a variety of reasons. I can recall some -

  • Obscure code that may have a script to update things but little documentation on how to run or even if it is required to run things in order to update. See https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/editors/jetbrains there is a Perl file in that. Should I be scared? I sure am.
  • Unclear of exactly how many places to update. What is cargoSHA256 here https://github.com/NixOS/nixpkgs/blob/b2679e8b4166c9fc08ca9a27b0ceb8f874842904/pkgs/development/tools/rust/rustup/default.nix#L22?
  • Things fail and there I severely lack knowledge of how to debug it. I have only recently started to see the trace on failure and scroll up to see a file failed to download and hence the derivation failed.
  • There are docs that give example of how to update Nixpkgs here https://nixos.org/manual/nixpkgs/stable/#chap-quick-start but in reality I try to add a package and fail and then next time I start from scratch. I have never been able to work with patchELF likely because I do not have the prerequisite knowledge and I would love to fix that.
  • This documentation for submitting patches https://nixos.org/manual/nixpkgs/stable/#chap-submitting-changes could be improved and maybe could use its own dedicated page.
  • https://nixos.org/manual/nixpkgs/stable/#chap-reviewing-contributions is such a great idea but I have faced issues mostly not being able to debug.

So three things – a) Debugging b) Better error messages and formatting of those messages c) a standard way for derivation developers to document their process

General, techniques.

@grahamc knows a lot of things as stated here https://twitter.com/grhmc/status/1333429379360284672 but can those patterns be documented? When would you do what? Overlays? Patches (global local)? Shell or env? I perhaps know some of these and even use shell.nix heavily but that is where I am limited.

Basically, this tweet into a whole page https://twitter.com/grhmc/status/1333411016705765377

And this one https://twitter.com/grhmc/status/1322539935589687296?s=20

Tools at the periphery

I found this https://github.com/ryantm/nixpkgs-update while trying to upgrade rustup. I could not even build it. The commands listed ran for ages. What was it doing? Perhaps it is something I should not have run but then it says it is a tool to facilitate auto updates wherever possible. LOL

Are there other such tools and if yes then how do people find them?

amanjeev avatar Dec 01 '20 01:12 amanjeev

The commands listed ran for ages.

It probably updates the full nixpkgs :smile:

davidak avatar Dec 17 '20 19:12 davidak