mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
a957893b26
This allows scripts to fetch their own dependencies via nix-shell. For instance, here is a Haskell script that, when executed, pulls in GHC and the HTTP package: #! /usr/bin/env nix-shell #! nix-shell -i runghc -p haskellPackages.ghc haskellPackages.HTTP import Network.HTTP main = do resp <- Network.HTTP.simpleHTTP (getRequest "http://nixos.org/") body <- getResponseBody resp print (take 100 body) Or a Perl script that pulls in Perl and some CPAN packages: #! /usr/bin/env nix-shell #! nix-shell -i perl -p perl perlPackages.HTMLTokeParserSimple perlPackages.LWP use HTML::TokeParser::Simple; my $p = HTML::TokeParser::Simple->new(url => 'http://nixos.org/'); while (my $token = $p->get_tag("a")) { my $href = $token->get_attr("href"); print "$href\n" if $href; } Note that the options to nix-shell must be given on a separate line that starts with the magic string ‘#! nix-shell’. This is because ‘env’ does not allow passing arguments to an interpreter directly. |
||
---|---|---|
.. | ||
build-remote.pl.in | ||
copy-from-other-stores.pl.in | ||
download-from-binary-cache.pl.in | ||
download-using-manifests.pl.in | ||
find-runtime-roots.pl.in | ||
install-nix-from-closure.sh | ||
local.mk | ||
nix-build.in | ||
nix-channel.in | ||
nix-collect-garbage.in | ||
nix-copy-closure.in | ||
nix-generate-patches.in | ||
nix-http-export.cgi.in | ||
nix-install-package.in | ||
nix-prefetch-url.in | ||
nix-profile.sh.in | ||
nix-pull.in | ||
nix-push.in | ||
nix-reduce-build.in | ||
show-duplication.pl |