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

niv source for hlint throws called without required argument 'ghc-lib-parser-ex' #249

Closed
codygman opened this issue Jul 19, 2020 · 1 comment

Comments

@codygman
Copy link

First I tried this code with shelllcheck and it worked:

# test-shellcheck-overlay.nix
{ sources ? import ./nixpkgs/nix/sources.nix }:     # import the sources
with
  { overlay = _: pkgs:
      { niv = import sources.niv {};    # use the sources :)
        shellcheck = pkgs.haskellPackages.callCabal2nix "shellcheck" sources.shellcheck {};
      };
  };
let mypkgs = import sources.nixpkgs { overlays = [ overlay ]; };
in mypkgs.mkShell {
  buildInputs = [
    mypkgs.shellcheck # when shellcheck overlay present we go from 0.7.0 to 0.7.1
  ]; }

Then I tried with hlint since I knew it could possibly be more complicated and depend on boot packages or ghc version specific things:

# test-niv-overlay.nix
{ sources ? import ./nixpkgs/nix/sources.nix }:     # import the sources
with
  { overlay = _: pkgs:
      { niv = import sources.niv {};    # use the sources :)
        hlint = pkgs.haskellPackages.callCabal2nix "hlint" sources.hlint { };
      };
  };
let mypkgs = import sources.nixpkgs { overlays = [ overlay ]; };
in mypkgs.mkShell {
  buildInputs = [
    # without overlay this gives 2.2.2, after it should give 3.1.6 using
    # nix-shell test-niv-overlay.nix --run "hlint --version"
    mypkgs.hlint # should be 3.1.6 but it's not
  ]; }

It returns:

-*- mode: compilation; default-directory: "~/hci/" -*-
Compilation started at Sat Jul 18 23:18:52

nix-shell test-niv-overlay.nix --run "hlint --version"
error: anonymous function at /nix/store/2cvhh84x9jycqpgbxxpsq46qyyhbijbv-cabal2nix-hlint/default.nix:1:1 called without required argument 'ghc-lib-parser-ex', at /nix/store/08xfivmynisgv4lxp4d9x457x8a1qhcp-source/pkgs/development/haskell-modules/make-package-set.nix:87:27
(use '--show-trace' to show detailed location information)

Compilation exited abnormally with code 1 at Sat Jul 18 23:18:53

I have a feeling maybe I can provide ghc-lib-parser-ex... maybe via a different overlay.. but I'm not sure if that should be necessary.

@nmattia
Copy link
Owner

nmattia commented Jul 21, 2020

Hi! So, I'm not sure this is really a niv issue but I can try to help. When you're using callCabal2nix, it generates a nix file that takes hlint's dependencies as arguments, and then (IIRC) uses callPackage (the haskell one) on that. So that means your haskell package set does not have ghc-lib-parser-ex. There are various ways to add packages, but most likely you'll need to override the haskell package set. This ticket and the manual are good starting points.

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