5
submitted 1 year ago by nobloat@lemmy.ml to c/nixos@lemmy.ml

I hope this is the right place to ask. I am new to Nix and trying to use it for now as a universal package manager. I installled Stremio using Nix but the app doesn't work properly. I see that it's several versions out of date. The same app works fine using Flatpak. Is there a way to let the maintainer know? I'd also love some documentation that can help me update it myself. I can just use the Flatpak but I just want to have one less package manager to worry about.

you are viewing a single comment's thread
view the rest of the comments
[-] chkno@lemmy.ml 7 points 1 year ago* (last edited 1 year ago)

Bumping package versions usually isn't hard. Here, I'll do this one out loud here, & maybe you can do it next time you need to:

  1. Search https://github.com/NixOS/nixpkgs/pulls to see if someone else already has a PR open for a version bump for this package.
  2. Clone the nixpkgs repo if you haven't already: git clone https://github.com/NixOS/nixpkgs.git ~/devel/nixpkgs (or git pull if you have).
  3. Create a branch for this bump: git checkout -b stremio
  4. Find stremio: find pkgs -name stremio
  5. Edit it: $EDITOR pkgs/applications/video/stremio/default.nix Looks like nixpkgs has version 4.4.142. If I go to https://www.stremio.com/ (link in meta.homepage in this file) and click 'Download', it all says 4.4, which is not helpful. The 'source code' link goes to github, and the 'tags' link there lists version v4.4.164, which is what we're looking for.
  6. In my editor, I change the version: 4.4.1424.4.164.
  7. In my editor, I mess up both the hashes: I just add a block of zeros somewhere in the middle: sha256-OyuTFmEIC8PH4PDzTMn8ibLUAzJoPA/fTILee0xpgQI=sha256-OyuTFmEIC80000000000000000000A/fTILee0xpgQI=.
  8. Leaving my editor, I build the updated package: nix-build . -A stremio
  9. It fails, because the hashes are wrong, obviously. But it tells me what hash it got, which I copy/paste back in, in the spirit of collective TOFU. I do this twice, once for each hash.
  10. It builds successfully. I test the result: ./result/bin/stremio. Looks like it works enough to prompt me to log in, at least. I don't know what stremio is or have an account, but it's probably fine.
  11. I commit my change: git commit -a -m 'stremio: 4.4.142 -> 4.4.164'
  12. I push my commit: git push github (If this is your first time, create a fork of nixpkgs in the github web UI & git remote add a remote for it first)
  13. I create PR in the github web UI: https://github.com/NixOS/nixpkgs/pull/263387
[-] ck_@discuss.tchncs.de 4 points 1 year ago

Just fyi regarding point (7), there is lib.fakeHash for your convenience.

[-] madmaurice@discuss.tchncs.de 1 points 11 months ago

Actually now you can just leave it empty and it'll use a hash of all zeroes.

[-] ck_@discuss.tchncs.de 1 points 11 months ago

That is how fakeHash is defined, its just a bit more clear whats intended.

[-] madmaurice@discuss.tchncs.de 1 points 11 months ago

Right, but why would you need to show what's intended for something that you would not commit anyway? My point is if I add or update a package and don't know the hash for a particular derivation I need to put something temporarily to let nix fail and show me the hash it found out. And there I have the choice between typing something like lib.fakeHash or just "", of which imho the latter is way easier.

[-] nobloat@lemmy.ml 2 points 1 year ago

That's impressive! I'm gonna try this. I see I have a lot to learn with Nix

[-] jeffhykin@lemm.ee 3 points 1 year ago* (last edited 1 year ago)

Yep, most things with nix require this level of elbow grease to get done. Chkno did a great job explaining it. Honestly his response is worth putting in the docs IMO

this post was submitted on 25 Oct 2023
5 points (100.0% liked)

nixos

1259 readers
16 users here now

All about NixOS - https://nixos.org/

founded 4 years ago