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

Development dependencies #92

Open
jerbaroo opened this issue Jan 20, 2021 · 2 comments
Open

Development dependencies #92

jerbaroo opened this issue Jan 20, 2021 · 2 comments

Comments

@jerbaroo
Copy link

Project 2 on Non-Haskell dependencies describes how to include a dependency of the Haskell application being built. However what about a dependency that is only required for development e.g. haskell-language-server, it should be possible to include that in release.nix somehow so it is available in a Nix shell.

@jerbaroo
Copy link
Author

jerbaroo commented Jan 20, 2021

This is what I figured out can be done. Not sure if it's the best way to do things though.

let
  pkgs = import <nixpkgs> { };
  mypkg = pkgs.haskellPackages.callCabal2nix "mypkg" ./mypkg.cabal {};
  devTools = [ pkgs.haskell-language-server ];
in
  pkgs.lib.overrideDerivation mypkg.env (old: {
    buildInputs = old.buildInputs ++ devTools;
  })

@Gabriella439
Copy link
Owner

@jerbaroo: You can use pkgs.mkShell, which comes in handy for extending an existing derivation to create a shell-specific derivation.

For example, if pkgs.haskellPackages.mypkg.env contains the derivation for your default shell, then you can create an extended shell containing pkgs.haskell-language-server like this:

pkgs.mkShell {
  inputsFrom = [ pkgs.haskellPackages.mypkg.env ];

  nativeBuildInputs = [ pkgs.haskell-language-server ];
}

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