joelburget / react-haskell

React bindings for Haskell
MIT License
351 stars 26 forks source link

Nix all the things #19

Open commandodev opened 9 years ago

commandodev commented 9 years ago

I've replaced haste with ghcjs specfic stuff in .cabal and added a shell.nix and a default.nix.

If you have a checkout of nixpkgs you should be able to run:

⇒  nix-shell -I . --pure # I have a symlink to my checkout of nixpkgs in cwd                           

[nix-shell:~/dev/ghcjs/react-haskell]$ cabal configure --ghcjs
Warning: The package list for 'hackage.haskell.org' is 247.0 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Configuring react-haskell-1.3.0.0...

[nix-shell:~/dev/ghcjs/react-haskell]$ cabal build
Building react-haskell-1.3.0.0...
Preprocessing library react-haskell-1.3.0.0...

src/React/Anim.hs:9:8:
    Could not find module ‘Haste’
    Use -v to see a list of the files searched for.

src/React/Attrs.hs:6:8:
    Could not find module ‘Haste.JSON’
    Use -v to see a list of the files searched for.

src/React/Attrs.hs:7:8:
    Could not find module ‘Haste.Prim’
    Use -v to see a list of the files searched for.

src/React/Imports.hs:12:8:
    Could not find module ‘Haste.Foreign’
    Use -v to see a list of the files searched for.

src/React/Interpret.hs:6:8:
    Could not find module ‘Haste.DOM’
    Use -v to see a list of the files searched for.

So this seems to drop you into a sane nix-shell sans all the implementation changes you'd have to make to use ghcjs instead of haste :-)

joelburget commented 9 years ago

Thanks :) Going to leave this open for now, until I get a chance to look at the GHCJS stuff.

commandodev commented 9 years ago

Sure thing. Leaving out the cabal changes could probably be made to work for haste too, so give me a shout if you want to explore nix without ghcjs. :-) On 10 Feb 2015 21:58, "Joel Burget" notifications@github.com wrote:

Thanks :) Going to leave this open for now, until I get a chance to look at the GHCJS stuff.

— Reply to this email directly or view it on GitHub https://github.com/joelburget/react-haskell/pull/19#issuecomment-73792956 .

joelburget commented 9 years ago

By the way, why did you symlink your nixpkgs to the current directory? Is that a typical way of working?

commandodev commented 9 years ago

That's the way I do it. I like to have -I . so that you can symlink both local packages under development and nixpkgs in one go. You can install nixpkgs to a path globally (I think in ~/.nix-something) but I think is more flexible as you can point different projects at different nixpkg versions (e.g. for ghcjs).

On 28 February 2015 at 19:20, Joel Burget notifications@github.com wrote:

By the way, why did you symlink your nixpkgs to the current directory? Is that a typical way of working?

— Reply to this email directly or view it on GitHub https://github.com/joelburget/react-haskell/pull/19#issuecomment-76541127 .

Regards, Ben Ford ben.fordnz@gmail.com +447540722690

AphonicChaos commented 9 years ago

Pardon me if I'm being daft, @boothead , but this simply exposes react-haskell to nix, doesn't force it's usage, right?

commandodev commented 9 years ago

You are correct @aspidites. Nothing is forced, just consider it a strong hint ;-)