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

Use extra-packages in modules/hackage-project.nix #2310

Merged
merged 17 commits into from
Feb 5, 2025

Conversation

hamishmack
Copy link
Collaborator

@hamishmack hamishmack commented Jan 28, 2025

This is a step towards removing the dependency on hackage.nix.

Instead of looking up the source for a tool using hackage.nix it lets make-install-plan to it using the cabal planner (based on an extra-packages: entry in a cabal.project file).

@hamishmack hamishmack merged commit 908d11a into master Feb 5, 2025
5235 checks passed
@mrkline
Copy link

mrkline commented Feb 10, 2025

This seems to break stackProject. With:

let haskellSrc = builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/cc140d188d53692a43a86cc7e4849702a3f04389.tar.gz";
    haskellNix = import haskellSrc {};
    pkgs = import
        haskellNix.sources.nixpkgs
        haskellNix.nixpkgsArgs;
    project = pkgs.haskell-nix.stackProject {
      src = pkgs.haskell-nix.cleanSourceHaskell {
        name = "blah";
        src = ./.;
      };
      modules = [
        { enableProfiling = true;
          enableLibraryProfiling = true;
        }
      ];
    };
in project.shellFor {
    exactDeps = true;
    tools = {
      cabal = "latest";
      hlint = "latest";
      haskell-language-server = "latest";
    };
}

I get

$ nix-shell
error:
...
         at /nix/store/2iva5ci4a20hg1iig1jzkkb6kixvv41s-source/overlays/haskell.nix:970:25:

          969|         stackProject = args: let p = stackProject' args;
          970|             in p.hsPkgs // p;
             |                         ^
          971|

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: undefined variable 'hackage'

       at /nix/store/2iva5ci4a20hg1iig1jzkkb6kixvv41s-source/overlays/haskell.nix:113:47:

          112|                 # The compiler referenced in the stack config
          113|                 compiler = (stack-pkgs.extras hackage).compiler or (pkg-def hackage).compiler;
             |                                               ^
          114|                 patchesModule = ghcHackagePatches.${compiler.nix-name} or {};

@thomasjm
Copy link
Contributor

I noticed the same -- this breaks Haskell.nix for my Stack-based project.

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

Successfully merging this pull request may close these issues.

3 participants