Nix packages on a non-nix distro : what to do when a package isn't working properly ?
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.
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).
Create a branch for this bump: git checkout -b stremio
Find stremio: find pkgs -name stremio
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.
In my editor, I change the version: 4.4.142 → 4.4.164.
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=.
Leaving my editor, I build the updated package: nix-build . -A stremio
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.
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.
I commit my change: git commit -a -m 'stremio: 4.4.142 -> 4.4.164'
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)
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
A huge time saver/helper can be searching the nix discourse. But don't be afraid to ask. You might get grumpy answers but Nix is hard so dont feel bad about it.
The expected approach is to go to the nixpkgs github and post an issue. The issue will ask you to tag the maintainers, which requires looking them up using search.nixos.org or by using the nix repl (nixpkgs.yourThing.meta.maintainers).
If you want to update it yourself, you can usually use the nix repl to find out where the relevent code is with builtins.unsafeGetAttrPos "yourThing" nixpkgs. Once you know where it is you can fork the nixpkgs github and change it. You can then use/test your fork directly with any of the normal nix commands. For nix-env i blelieve its nix-env -iA something -I url_to_your_github_fork_as_a_tar_file. There's another flag for using the local folder (instead of a url to a tarball) but I forget what it is.