Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@maxhbr
Copy link

@maxhbr maxhbr commented May 13, 2016

generated via:

$ cabal2nix ./ >default.nix
$ cabal2nix --shell ./ >shell.nix
### Not testet yet!

I will make a comment once I have tested them

@fmthoma
Copy link
Owner

fmthoma commented Jun 5, 2016

@MaximilianHuber did you test yet?

@maxhbr
Copy link
Author

maxhbr commented Jun 5, 2016

No, not yet, sorry. Still the same problems with the nixos+cabal setup due to the usage of the homedir by another OS.

@maxhbr
Copy link
Author

maxhbr commented Dec 28, 2016

Testing nix-shell:

$ nix-shell
[nix-shell:~vgrep]$ stack build
dlist-0.7.1.2: using precompiled package
data-default-class-0.0.1: using precompiled package
[...]
Registering vgrep-0.2.0.0...
Completed 60 action(s).
[nix-shell:~vgrep]$ stack exec vgrep test ./

works for me

@fmthoma
Copy link
Owner

fmthoma commented Jan 5, 2017

It should not matter for stack whether or not you are in a nix-shell: The correct ghc version is fetched via Nix (when --nix is given), but the dependencies are fetched and compiled by stack itself.

That said, I just tried

> nix-build shell.nix
…
these derivations will be built:
  /nix/store/ks711vnkl5bj7bb9x749ns02yyzzxm3f-vgrep-0.2.0.0.drv
building path(s) ‘/nix/store/x5l3ah5mxfxradrl6im6rlimx2i42xrd-vgrep-0.2.0.0’
…
installing
Installing library in
/nix/store/x5l3ah5mxfxradrl6im6rlimx2i42xrd-vgrep-0.2.0.0/lib/ghc-8.0.1/vgrep-0.2.0.0
Installing executable(s) in
/nix/store/x5l3ah5mxfxradrl6im6rlimx2i42xrd-vgrep-0.2.0.0/bin
Warning: The directory
/nix/store/x5l3ah5mxfxradrl6im6rlimx2i42xrd-vgrep-0.2.0.0/bin is not in the
system search path.
Creating package registration file:
/nix/store/x5l3ah5mxfxradrl6im6rlimx2i42xrd-vgrep-0.2.0.0/lib/ghc-8.0.1/package.conf.d/vgrep-0.2.0.0.conf
…
patching script interpreter paths in /nix/store/x5l3ah5mxfxradrl6im6rlimx2i42xrd-vgrep-0.2.0.0
/nix/store/x5l3ah5mxfxradrl6im6rlimx2i42xrd-vgrep-0.2.0.0

which does what it should do.

I'm a bit torn: On one hand, this enables Nix users to build vgrep from source using Nix, without having to install stack (and without having to wait until lens is compiled). On the other hand, this poses extra maintenance, and room for errors (like forgetting to bump the version number…).

And after all, generating these two files is a simple nix-shell -p cabal2nix --run 'cabal2nix . > default.nix; cabal2nix --shell . > shell.nix' away. So I think it would be worth considering to either add a build manual for Nix to the README.md file, or a nix-setup script that generates these files?

@fmthoma
Copy link
Owner

fmthoma commented Jan 5, 2017

This is a minimal script for generating default.nix and shell.nix:

#!/usr/bin/env nix-shell
#! nix-shell -p cabal2nix -i bash
cabal2nix .         > default.nix
cabal2nix --shell . > shell.nix

@maxhbr maxhbr force-pushed the contrib/addNixFiles branch from 67c27ea to e56e0ae Compare January 7, 2017 10:32
@maxhbr
Copy link
Author

maxhbr commented Jan 7, 2017

I have modified the README and removed the nix files

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.

2 participants