snack icon indicating copy to clipboard operation
snack copied to clipboard

Ghci does not read package dependencies.

Open zhujinxuan opened this issue 5 years ago • 3 comments

Example: in this project,

cd tests/library
snack ghci

will create an warning as

snack/tests/library/src/FooBar.hs:3:1: error:
    Could not find module ‘Conduit’
    Perhaps you haven't installed the "dyn" libraries for package ‘conduit-1.3.1.1’?
    Use -v to see a list of the files searched for.
  |
3 | import Conduit
  | ^^^^^^^^^^^^^^
Failed, no modules loaded.
Prelude>

zhujinxuan avatar Nov 18 '19 22:11 zhujinxuan

I think we shall pass packageDependencies somewhere in ghci.nix

zhujinxuan avatar Nov 18 '19 23:11 zhujinxuan

@nmattia I think we just need to add dependency in https://github.com/nmattia/snack/blob/069f7d01fbb2400b8f8bd43dbff16478e3cd4d0e/snack-lib/ghci.nix#L33

But I do not how to find document of nix functions as writeScriptBin and makeWrapper. Can I know where I can find it?

zhujinxuan avatar Nov 22 '19 22:11 zhujinxuan

writeScriptBin is fairly straightforward: it simply wraps writeText.

The following:

writeScriptBin “foo” “bar”

will write bar to $out/bin/foo and make foo executable.

The documentation for makeWrapper is a bit hard to find: https://github.com/NixOS/nixpkgs/blob/b339f29a277cd430c7fdd1677bcbb59ca6619945/pkgs/build-support/setup-hooks/make-wrapper.sh#L10-L29 (note that makeWrapper is not a “nix” function but a bash function).

nmattia avatar Nov 23 '19 07:11 nmattia