Created
May 23, 2020 20:07
-
-
Save elaforge/15cb35067ce81b44c81ca429a16f25b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. It would be nice to include guidance on how to pick a nixpkgs commit. | |
I went to github and picked the latest from nixos-19.09. Then how do we know | |
which version of ghc it has? I did `nix repl` then `n = import nixpkgs.nix {}` | |
then use n.<tab> to see what's inside, but that's clumsy. Surely there's some | |
better way? | |
. I used `fetchTarball` to get nixpkgs, not `fetchGit`. fetchGit locked up my | |
laptop... probably it's just slower and nixpkgs is repo. | |
. I have to pass --option max-jobs 4 (less than default of 32) or it kills the | |
laptop by trying to run too much at once. | |
. `-L` gets `nix build` to print the build logs, so you can see what it's | |
doing. | |
. `nixpkgs.nix-prefetch-git` doesn't have `prefetch-url` as the post suggests. | |
The proper name is nix-prefetch-url, and it seems to be included with nix itself. | |
. The overlay didn't seem to have an effect, but my old packageOverrides thing | |
does work. | |
. You have to decide on the package versions to use in the first place, which | |
means you need `cabal freeze`. So I think the workflow has to be, write the | |
cabal file, then `cabal freeze`, then parse the `cabal.config`. Since it's not | |
practical to manually get hashes for more than a few packages, I wrote a script | |
to do this. I haven't looked into the v2 freeze file yet, it's significantly | |
different because it also encodes the build flags. These probably need to be | |
propagated to callCabal2Nix. | |
. Here's the big thing though: it turns out that `callHackageDirect` is broken. | |
The problem is that it doesn't take metadata revisions into account, so you run | |
into an unbuildable package pretty soon. Since the versions are generated by | |
cabal, it should be possible to doJailbreak, but I discovered that | |
`jailbreak-cabal` is also unreliable, because it misses versions in flags. | |
From a look at cabal docs, "--allow-older --allow-newer" is the real way to do | |
this, but apparently this is brand new, because while 3.2.0.0 has it, 3.0.1.0 | |
apparently doesn't. Since Cabal is a bootlib, it's locked to the ghc version. | |
So, we need a better callHackageDirect. Actually it wasn't hard to write one, | |
since I found out you can download patched cabal files from the | |
`all-cabal-files` github repo. I modified the sha-fetching script to fetch two | |
hashes and wrote a derivation to combine them, and then call `callCabal2Nix` on | |
that. | |
I still need to patch some packages which are broken in nixpkgs: zlib and | |
digest at least. But after that it seems like it actually works, though | |
I haven't done the plumbing yet to actually compile with these packages. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment