Hi,

 > users [of nixos-unstable] have to use a slightly modified version of
 > the script that looks as follows:
 >
 >  | #! /usr/bin/env nix-shell
 >  | #! nix-shell -i runghc -p "haskellPackages.ghcWithPackages (p: [p.HTTP])"
 >  [...]

it turns out that script won't work either. It seemed to work when I
tested it on my machine, but that was only because I had "runghc" in
$PATH already. Adding "--pure" reveals the issue:

 | #! /usr/bin/env nix-shell
 | #! nix-shell --pure -i runghc -p "haskellPackages.ghcWithPackages (p: 
[p.HTTP])"
 |
 | import Network.HTTP
 |
 | main = do
 |   resp <- Network.HTTP.simpleHTTP (getRequest "http://nixos.org/";)
 |   body <- getResponseBody resp
 |   print (take 100 body)

When run, that script fails as follows:

  $ /tmp/test
  bash: exec: runghc: not found

The exact same mechanism works fine in a normal shell, however:

  $ nix-shell --pure -p "haskellPackages.ghcWithPackages (p: [p.HTTP])" --run 
"ghc-pkg list HTTP"
  
/nix/store/qxwql6in0v13i83p8vrvm7ma9i2aash4-ghc-7.10.1/lib/ghc-7.10.1/package.conf.d
     HTTP-4000.2.19

I've tried for a while now, but I could not figure out how to make a
non-trivial Haskell script work with nix-shell.

Best regards,
Peter

_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to