Difference between revisions of "Talk:Update a package"

From NixOS Wiki
Jump to: navigation, search
m
m
Line 5: Line 5:
 
The page recommends to use `nix-prefetch-url` but that outputs a raw sha256 hash, while it is possible to convert the output to a proper SRI hash using  
 
The page recommends to use `nix-prefetch-url` but that outputs a raw sha256 hash, while it is possible to convert the output to a proper SRI hash using  
  
```
+
<syntaxhighlight lang="bash">
 
$ nix-prefetch-url 'http://i3wm.org/downloads/i3-4.5.1.tar.bz2' | xargs nix hash to-sri --type sha256
 
$ nix-prefetch-url 'http://i3wm.org/downloads/i3-4.5.1.tar.bz2' | xargs nix hash to-sri --type sha256
```
+
</syntaxhighlight>
  
 
I feel the page would benefit from being updated to use `nix store prefetch-file` instead. Both are discussed in https://discourse.nixos.org/t/why-does-nix-prefetch-url-not-return-hashes-in-sri-format/18271
 
I feel the page would benefit from being updated to use `nix store prefetch-file` instead. Both are discussed in https://discourse.nixos.org/t/why-does-nix-prefetch-url-not-return-hashes-in-sri-format/18271

Revision as of 08:14, 13 March 2025

Outdated hashing practice

I think the page is currently outdated with regards to hashing best practices. I tried following the page to update the zettlr package but it uses an SRI hash instead of directly sha256, and so does the current i3 package definition.

The page recommends to use `nix-prefetch-url` but that outputs a raw sha256 hash, while it is possible to convert the output to a proper SRI hash using

$ nix-prefetch-url 'http://i3wm.org/downloads/i3-4.5.1.tar.bz2' | xargs nix hash to-sri --type sha256

I feel the page would benefit from being updated to use `nix store prefetch-file` instead. Both are discussed in https://discourse.nixos.org/t/why-does-nix-prefetch-url-not-return-hashes-in-sri-format/18271