h
nice tool if you ever repackage stuff in nix https://github.com/nix-community/nurl
Copy code
> nurl https://git.sr.ht/~raphi/somebar/ 1.0.3
$ nix flake prefetch --extra-experimental-features 'nix-command flakes' --json sourcehut:~raphi/somebar/1.0.3
fetchFromSourcehut {
  owner = "~raphi";
  repo = "somebar";
  rev = "1.0.3";
  hash = "sha256-PBxCy1dZrOL1nmhVDQozvF0XL79uKMhhERGNpPPzaRU=";
}
j
That's super nice! I typically just find the docs for the fetcher and use
lib.fakeHash
and then update the hash with the one it prints when it fails. Nurl looks way better 😂
h
hahaha
the amount of tooling that exists as workarounds to getting the hash setup is hilarious
I had no idea
lib.fakeHash
was a thing but it should tell us that there's gotta be a better solution
j
Yeah, it's kind of a dumb problem. Especially because there's special hashes specifically for Nix packaging
But yeah, TOFU (i.e. use
lib.fakeHash
, update the hash after failure) is the documented way to get hashes in nixpkgs manual: https://nixos.org/manual/nixpkgs/stable/#chap-pkgs-fetchers-caveats
nix-prefetch-url
is terrible, too -- so makes sense that a tool like nurl would fix it
h
for sure.
j
Like, I don't know why `nix-prefetch-url`'s default behavior is to print a totally worthless hash
h
we love default nix tooling
apparently there is also a tool called nix-init which does some auto population of dependencies for a package using a git link (it uses nurl) which looks super interesting!
j
Yes, also see
nix init
for flakes.
You can create a flake template for
nix init
, too, if there are standard tools/layout you want in all your flakes
h
that's sick!
I've found myself using dev shells and flakes a lot more as of recent, so this may be a boon
j
I like direnv (nix-direnv, specifically) for setting up dev shells automatically. Has allowed me to drop tons of project-specific/development packages from my system-wide installations
h
I'm at 30+ dev dependencies in my packages file rn lmao
why in starting to switch
j
i.e. if I have Nix, my shell and text editor configured I can do development right after
cd
-ing into a project
I especially love that workflow at work where I don't necessarily want my NixOS/Nix-Darwin configuration -- but still want the conveniences of Nix
(Even though I love NixOS, I think it's usually a terrible choice in an enterprise environment unless EVERYBODY is on board)
h
yeahh
I don't think I'd want to wish involuntary nix on anyone
6 Views