input-output-hk/stack2nix

project environment

Opened this issue · 2 comments

is there a smart way to generate a cabal environment for a project that does not contain a top level package?

E.g. a stack.yaml file that contains:

packages:
  - package1
  - package2
  - package3

I can do nix-shell -A package1.env default.nix but I will only get the dependencies of package1. It would be nice to get the combined environments of package1, package2, package3.

I can do this manually, getting all dependencies with stack ls dependencies or something similar ...

This is probably a nixpkgs issue, how to compose haskell environments.

There is actually a shellFor function that may be able to be used in the above situation.

https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/haskell-modules/make-package-set.nix#L234-L304

However, you have to manually specify the packages you want to use as arguments to shellFor.

It would be nice if stack2nix somehow produced a list of packages that are actually "local packages defined in stack.yaml" (instead of dependencies pulled from stackage). That list of packages would be able to be easily used in functions like shellFor.