[Nix-dev] Building Haskell Package with Tests and Data Files.

Bas van Dijk v.dijk.bas at gmail.com
Tue Dec 22 23:19:59 CET 2015


Why didn't I think of that...

Thanks Peter!

On 22 December 2015 at 21:32, Peter Simons <simons at cryp.to> wrote:
> Hi Bas,
>
>  > I have a Haskell library that contains a test-suite. The test
>  > requires a data file of the package. When building the package with
>  > nix-build the test is run but fails because the path to the data file
>  > is wrong.
>
> "cabal test" executes test suites with the current working directory set
> to the top-level directory of your source code, i.e. the same place
> where the "myLib.cabal" file is. Therefore, your test code can refer to
> the data file reliably as "data/Lenna.png".
>
> If you ever want to release that project on Hackage, make sure to
> add an attribute like
>
>   extra-source-files: data/*
>
> in your Cabal file, otherwise those data files will not be included in
> the generated release tarball. If you're fine with those files being
> *installed*, then the attribute
>
>   data-files: data/*
>
> is preferable, of course.
>
> Best regards,
> Peter
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev


More information about the nix-dev mailing list