ElvishJerricco / purescript-packages2nix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use nix-prefetch-git to pre-compute hashes

sopvop opened this issue · comments

I think that this tool should do the nix-prefetch-git dance to get source hash, just like every other x2nix tool does.

Also in case of github you can use fetchFromGithub to fetch zips and nix-prefetch-zip to get sha sum as it is much faster.

Looking forward to using this tool once I figure out a less painful way to get all deps into a psc packages set :)

Well I'm not using fetchFromGitHub because there's no guarantee the packages in the package set are on GitHub. As for hashes, yea I was just being lazy =P Fetching the repo for every single package in the package set would be take a while.

Well I'm not using fetchFromGitHub because there's no guarantee the packages in the package set are on GitHub.

That would require parsing urls and checking if it points to github, so yeah extra work. But since, like, 90% of purescript packages use github repos the win would be yuge since fetching zips is usually much faster than git commits.

Fetching the repo for every single package in the package set would be take a while.

That's true, but you don't have to do it very often. If I'm not mistaken, hackage2nix fetches almost all tarballs from hackage, and @peti updates it once a week or so.

Btw, this ticket is not like "feature request, implement ASAP". It's more like - should have if this package ever becomes a "official nixpkgs purescript thing". In that case it would also be usefult to able to somehow "add" packages which are not in a set, and it's not obvious how to do that. Maybe psc-package would be able to use several sets, so that will be a part of solution.

In that case it would also be usefult to able to somehow "add" packages which are not in a set, and it's not obvious how to do that.

What do you mean by this? Do you mean like overriding the purescript-packages to add packages?

What do you mean by this? Do you mean like overriding the purescript-packages to add packages?

Hm, maybe it should fetch sources from repo, parse psc-package.json write nix expression with dependencies but without adding expressions for dependencies themselves. Can be a separate tool, like cabal2nix and not like (hackage|stackage)2nix which generate derivations for everything.

Or generate an override expression with multiple packages from your own packages.json (which may miss some deps, to be provided by other set). So you can do something like:

{ nixpkgs ? import <nixpkgs> {} }:
let
  pscPackages = nixpkgs.pscPackages; # we will have it, I'm sure
in import ./myoverrides.nix { inherit pscPackages; }

That would be useful too!

Oh yea having an individual package -> Nix tool would also be good. This currently only does a whole package set