Hi,

 > nix-shell can now be used as a #!-interpreter. This allows you to write
 > scripts that dynamically fetch their own dependencies. For example,
 > here is a Haskell script that, when invoked, first downloads GHC and
 > the Haskell packages on which it depends: [...].

users running current versions of nixos-unstable (or the master branch)
would 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])"
 |
 | import Network.HTTP
 |
 | main = do
 |   resp <- Network.HTTP.simpleHTTP (getRequest "http://nixos.org/";)
 |   body <- getResponseBody resp
 |   print (take 100 body)

Best regards,
Peter

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

Reply via email to