aboutsummaryrefslogtreecommitdiff
path: root/scripts/nix-build.in
AgeCommit message (Collapse)Author
2016-08-09nix-build: Port to c++Shea Levy
This was a dumb line-for-line rewrite, because nix build/nix run/etc. will replace it.
2016-05-03Merge pull request #883 from sheenobu/bugfix/ruby_shebangEelco Dolstra
Workaround to support ruby as an interpreter
2016-04-25Improved logging abstractionEelco Dolstra
This also gets rid of --log-type, since the nested log type isn't useful in a multi-threaded situation, and nobody cares about the "pretty" log type.
2016-04-18Workaround to support ruby as an interpreterSheena Artrip
2016-01-20Fix broken call to shellwordsBrian McKenna
nix-shell shebangs were broken by 9018deab
2016-01-05propagate NIX_BUILD_SHELL also in pure builds document NIX_BUILD_SHELL in ↵Fabian Schmitthenner
the nix-shell command documentation
2015-12-07Use shellwords for nix-shell shebangBrian McKenna
Previously we can't have quoted arguments. This now allows us to use things like `ghcWithPackages`
2015-06-01nix-shell: Support multiple "#! nix-shell" linesEelco Dolstra
2015-05-21nix-shell: Barf if -p and -E are both usedEelco Dolstra
Closes #454, #455.
2015-05-05nix-shell: Fix uninitialized value warningEelco Dolstra
2015-02-18Escape arguments to nix-shell #! scriptsEelco Dolstra
2015-02-18Support passing command line arguments to nix-shell #! scriptsEelco Dolstra
2015-02-18Fix nix-shell shebang scripts if -p is usedEelco Dolstra
2015-02-08nix-build: Respect -Q during evaluationShea Levy
Fixes #474
2015-01-28Moves runHook to a later execution positionOliver Dunkl
It moves runHook to a later position in the rcfile. After that we are able to set the PS1 environment-variable for a nix-shell environment e.g.: # turn the color of the prompt to blue shellHook = '' export PS1="\n\[\033[1;34m\][\u@\h:\w]$\[\033[0m\] "; '';
2015-01-08nix-shell: Add --run flagEelco Dolstra
‘--run’ is like ‘--command’, except that it runs the command in a non-interactive shell. This is important if you do things like: $ nix-shell --command make Hitting Ctrl-C while make is running drops you into the interactive Nix shell, which is probably not what you want. So you can now do $ nix-shell --run make instead.
2015-01-08nix-shell: Interpret filenames relative to the #!-scriptEelco Dolstra
So you can have a script like: #! /usr/bin/env nix-shell #! nix-shell script.nix -i python import prettytable x = prettytable.PrettyTable(["Foo", "Bar"]) for i in range(1, 10): x.add_row([i, i**2]) print x with a ‘script.nix’ in the same directory: with import <nixpkgs> {}; runCommand "dummy" { buildInputs = [ python pythonPackages.prettytable ]; } "" (Of course, in this particular case, using the ‘-p’ flag is more convenient.)
2015-01-08Allow nix-shell to be used as a #! interpreterEelco Dolstra
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.
2015-01-07nix-shell --command: Remove bogus argument to "exit"Eelco Dolstra
Fixes "exit: Inappropriate: numeric argument required" errors.
2014-12-05Fix another operator precedence issue found by Perl 5.20Eelco Dolstra
2014-08-29Shut up "Wide character" warnings in Perl scriptsEelco Dolstra
2014-08-20Use proper quotes everywhereEelco Dolstra
2014-08-17nix-build: Propagate exit status from nix-store -rEelco Dolstra
2014-08-13nix-shell: Use $XDG_RUNTIME_DIREelco Dolstra
This prevents collisions with other users. Fixes #262.
2014-08-13Use $XDG_RUNTIME_DIR for temporary filesEelco Dolstra
2014-05-26nix-build: --add-root also takes 1 parameterAristid Breitkreuz
2014-04-08nix-shell --pure: Keep the user's $PAGEREelco Dolstra
2014-03-30Fix nix-shell for derivation with multiple outputsMaxim Ivanov
If derivation declares multiple outputs and first (default) output if not "out", then "nix-instantiate" calls return path with output names appended after "!". Than suffix must be stripped before ant path checks are done.
2014-03-17nix-build: Fix --cores flagEelco Dolstra
2014-02-19nix-shell: Add --packages flagEelco Dolstra
This allows you to easily set up a build environment containing the specified packages from Nixpkgs. For example: $ nix-shell -p sqlite xorg.libX11 hello will start a shell in which the given packages are present.
2014-02-19nix-instantiate: Add a flag --expr / -E to read expressions from the command ↵Eelco Dolstra
line This is basically a shortcut for ‘echo 'expr...' | nix-instantiate -’. Also supported by nix-build and nix-shell.
2014-02-19nix-shell: Don't leave a temporary directory in /tmp behindEelco Dolstra
2014-02-18Add a flag ‘--check’ to verify build determinismEelco Dolstra
The flag ‘--check’ to ‘nix-store -r’ or ‘nix-build’ will cause Nix to redo the build of a derivation whose output paths are already valid. If the new output differs from the original output, an error is printed. This makes it easier to test if a build is deterministic. (Obviously this cannot catch all sources of non-determinism, but it catches the most common one, namely the current time.) For example: $ nix-build '<nixpkgs>' -A patchelf ... $ nix-build '<nixpkgs>' -A patchelf --check error: derivation `/nix/store/1ipvxsdnbhl1rw6siz6x92s7sc8nwkkb-patchelf-0.6' may not be deterministic: hash mismatch in output `/nix/store/4pc1dmw5xkwmc6q3gdc9i5nbjl4dkjpp-patchelf-0.6.drv' The --check build fails if not all outputs are valid. Thus the first call to nix-build is necessary to ensure that all outputs are valid. The current outputs are left untouched: the new outputs are either put in a chroot or diverted to a different location in the store using hash rewriting.
2014-02-17nix-shell: Execute shellHook if it existsEelco Dolstra
Since normal builds don't execute shellHook, this allows nix-shell specific customisation. Suggested by Domen.
2014-02-10nix-shell: Use shell.nix as the default expression if it existsEelco Dolstra
2014-01-23nix-shell: Add --impure flagEelco Dolstra
This is currently the default, but I might change that to --pure in the future.
2014-01-23nix-shell: Preserve the TZ variable of the userEelco Dolstra
2014-01-23nix-build: RefactorEelco Dolstra
2014-01-13nix-shell: Don't set NIX_INDENT_MAKEEelco Dolstra
It generally is not useful in interactive environments (and messes up some non-ANSI-compliant terminals).
2014-01-13nix-shell: Set $IN_NIX_SHELL before evaluatingEelco Dolstra
2014-01-06Revert "nix-shell: Set $IN_NIX_SHELL before evaluation"Eelco Dolstra
This reverts commit 0c1198cf08576f16633b2344dc6513cefb567cfc.
2013-12-30nix-shell --pure: Don't clear IN_NIX_SHELLShea Levy
Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-20nix-shell: Don't warn about the lack of a GC rootEelco Dolstra
2013-12-20nix-shell: Set $IN_NIX_SHELL before evaluationEelco Dolstra
This has some hacky applications.
2013-12-20nix-shell: Handle --option correctlyEelco Dolstra
Fixes #181.
2013-12-17nix-shell --pure: Keep $TERMEelco Dolstra
2013-10-18Don't set $PS1 in non-interactive shellsEelco Dolstra
Shouldn't really matter, but you never know.
2013-10-18nix-shell: Play nicely with non-interactive shellsShea Levy
nix-shell with the --command flag might be used non-interactively, but if bash starts non-interactively (i.e. with stdin or stderr not a terminal), it won't source the script given in --rcfile. However, in that case it *will* source the script found in $BASH_ENV, so we can use that instead. Also, don't source ~/.bashrc in a non-interactive shell (detectable by checking the PS1 env var) Signed-off-by: Shea Levy <shea@shealevy.com>
2013-10-14nix-shell: Fix bash completionEelco Dolstra
Nixpkgs's stdenv setup script sets the "nullglob" option, but doing so breaks Bash completion on NixOS (when ‘programs.bash.enableCompletion’ is set) and on Ubuntu. So clear that flag afterwards. Of course, this may break stdenv functions in subtle ways...
2013-09-06nix-shell: Support a .drv as argumentEelco Dolstra
Fixes #161.