[Nix-dev] Nix 1.9 released

Peter Simons simons at cryp.to
Sat Jun 13 20:02:44 CEST 2015


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



More information about the nix-dev mailing list