Skip to content

Instantly share code, notes, and snippets.

@mpickering
Last active August 11, 2018 09:42
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpickering/fd26e9f03d6cb88cbb91b90b6019f3dd to your computer and use it in GitHub Desktop.
Save mpickering/fd26e9f03d6cb88cbb91b90b6019f3dd to your computer and use it in GitHub Desktop.
Using head.hackage

How to test your package with ghc-8.6.1

  1. Setup the binary cache -
cachix use mpickering

For only GHC

nix build -f https://github.com/mpickering/head.hackage/archive/master.tar.gz haskellPackages.ghc

or for a shell with GHC in

nix run -f https://github.com/mpickering/head.hackage/archive/master.tar.gz haskellPackages.ghc

For a package on Hackage

nix build -I nixpkgs=https://github.com/mpickering/head.hackage/archive/master.tar.gz '(with import <nixpkgs> {}; haskellPackages.callHackage "haskell-src-exts" "1.20.2" {})'

For a local package

nix build -I nixpkgs=https://github.com/mpickering/head.hackage/archive/master.tar.gz '(with import <nixpkgs> {}; haskellPackages.callCabal2nix "groups" ./groups-0.4.1.0 {})'

What do I do if my package doesn't build?

Either fix the dependencies like you would normally for a Haskell project on nix or you can contribute patches upstream to the head.hackage repo. For example:

nix build -f test.nix -I nixpkgs=https://github.com/mpickering/head.hackage/archive/master.tar.gz 
# test.nix
with import <nixpkgs> {};                                                          
let                                                                                
  # Disable testing of comonad                                                     
  hp = haskellPackages.extend(sel: sup: { comonad = haskell.lib.dontCheck sup.comonad; } );
in                                                                                 
  hp.comonad 
@DanBurton
Copy link

I tried the "For only GHC" instructions on OSX. It failed like so:

$ cachix use mpickering
$ nix build -f https://github.com/bgamari/head.hackage/archive/master.tar.gz haskellPackages.ghc
builder for '/nix/store/yysg9zjizqg3wd17lp1l69xx9sc9ckqh-hs-generate-overrides-0.1.drv' failed with exit code 1; last 10 log lines:
        _hs_iconv_open in libHSbase-4.10.1.0.a(iconv.o)
       (maybe you meant: _hs_iconv_open)
    "_iconv_close", referenced from:
        _hs_iconv_close in libHSbase-4.10.1.0.a(iconv.o)
       (maybe you meant: _hs_iconv_close)
    "_locale_charset", referenced from:
        _localeEncoding in libHSbase-4.10.1.0.a(PrelIOUtils.o)
  ld: symbol(s) not found for architecture x86_64
  clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)
  `cc' failed in phase `Linker'. (Exit code: 1)
[1 built (1 failed), 270 copied (3002.8 MiB), 357.7 MiB DL]
error: build of '/nix/store/yysg9zjizqg3wd17lp1l69xx9sc9ckqh-hs-generate-overrides-0.1.drv' failed

I'm assuming the important bit is

  ld: symbol(s) not found for architecture x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment