Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hackage2nix can't be installed, unable to use ./update-nixpkgs.sh #443

Closed
Kiwi opened this issue Feb 29, 2020 · 4 comments
Closed

hackage2nix can't be installed, unable to use ./update-nixpkgs.sh #443

Kiwi opened this issue Feb 29, 2020 · 4 comments

Comments

@Kiwi
Copy link
Member

Kiwi commented Feb 29, 2020

I tried following the instructions here (I am on nixos-unstable/nixpkgs master) https://github.com/NixOS/cabal2nix/tree/master/hackage2nix and it errors. cabal install fails, too.

output of ./update-nixpkgs.sh

<command line>: can't load .so/.DLL for: libz.so (libz.so: cannot open shared object file: No such file or directory)
cabal: Failed to build cabal2nix-2.15.0 (which is required by exe:hackage2nix
from cabal2nix-2.15.0).

*** error 1: cabal -v0 new-run hackage2nix -- --nixpkgs="$PWD/nixpkgs" +RTS -M4G -RTS

at first I couldn't fix it how I normally do with a shell.nix that brings in zlib. When I did it then failed with hpack errors etc... anyway, I finally got it while typing up this issue!

{ nixpkgs ? import <nixpkgs> {}, compiler ? "ghc865" }:

let
  inherit (nixpkgs) pkgs;

  ghc = pkgs.haskell.packages.${compiler}.ghcWithPackages (ps: with ps; [
    adjunctions
    aeson
    bytestring
    cabal2nix
    containers
    directory
    distribution-nixpkgs
    filepath
    free
    hackage-db
    hopenssl
    hpack
    invariant
    kan-extensions
    language-nix
    lens
    math-functions
    monad-par
    monad-par-extras
    mtl
    mwc-random
    optparse-applicative
    profunctors
    semigroupoids
    split
    tasty
    tasty-golden
    text
    time
    vector-th-unbox
  ]);
in
pkgs.stdenv.mkDerivation {
  name = "cabal2nix";
  buildInputs = with pkgs; [
    cabal-install
    ghc
    zlib
  ];

  shellHook = ''
      eval $(egrep ^export ${ghc}/bin/ghc)
  '';
}

it may have more or less packages than it should... but with this I was able to run ./update-nixpkgs.sh and cabal configure, cabal build, cabal test. and a few of the new-* and as seen above update-nixpkgs.sh uses new-run

Should I make a PR that adds this or something like it and updates the readme or? I could also change it to ghcWithHoogle to make development easier... anyway, hope this helps someone.

@peti
Copy link
Member

peti commented Feb 29, 2020

Please check out https://www.youtube.com/watch?v=qX0mgtSm360. The video has detailed instructions.

@peti peti closed this as completed Feb 29, 2020
@Kiwi
Copy link
Member Author

Kiwi commented Feb 29, 2020

15.9.4.11. Using hackage2nix with nixpkgs

Hackage package derivations are found in the hackage-packages.nix file within nixpkgs and are used as the initial package set for haskellPackages. The hackage-packages.nix file is not meant to be edited by hand, but rather autogenerated by hackage2nix, which by default uses the configuration-hackage2nix.yaml file to generate all the derivations.

To modify the contents configuration-hackage2nix.yaml, follow the instructions on hackage2nix.

https://nixos.org/nixpkgs/manual/

it'd be nice if the manual or the instructions in the readme the manual points to actually worked or at least linked to the video that is not easy to discover (and which is difficult to follow by the very nature of being a video)

@peti
Copy link
Member

peti commented Feb 29, 2020

Well, https://github.com/NixOS/cabal2nix/tree/master/hackage2nix does link to the video.

Anyhow, I'm sure the documentation can be improved a lot and I'd be happy to accept any PRs to that extend.

@Kiwi
Copy link
Member Author

Kiwi commented Feb 29, 2020

oh, so it does, my bad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants