vgrep icon indicating copy to clipboard operation
vgrep copied to clipboard

Add nix files

Open maxhbr opened this issue 9 years ago • 6 comments

generated via:

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

I will make a comment once I have tested them

maxhbr avatar May 13 '16 07:05 maxhbr

@maximilianhuber did you test yet?

fmthoma avatar Jun 05 '16 16:06 fmthoma

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

maxhbr avatar Jun 05 '16 16:06 maxhbr

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

maxhbr avatar Dec 28 '16 21:12 maxhbr

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 avatar Jan 05 '17 23:01 fmthoma

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

fmthoma avatar Jan 05 '17 23:01 fmthoma

I have modified the README and removed the nix files

maxhbr avatar Jan 07 '17 10:01 maxhbr