about summary refs log tree commit diff
path: root/scripts/nix-build.in
AgeCommit message (Collapse)AuthorFilesLines
2015-02-18 Escape arguments to nix-shell #! scriptsEelco Dolstra1-2/+6
2015-02-18 Support passing command line arguments to nix-shell #! scriptsEelco Dolstra1-2/+5
2015-02-18 Fix nix-shell shebang scripts if -p is usedEelco Dolstra1-1/+1
2015-02-08 nix-build: Respect -Q during evaluationShea Levy1-0/+5
Fixes #474
2015-01-28 Moves runHook to a later execution positionOliver Dunkl1-1/+1
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-08 nix-shell: Add --run flagEelco Dolstra1-2/+7
‘--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-08 nix-shell: Interpret filenames relative to the #!-scriptEelco Dolstra1-0/+7
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-08 Allow nix-shell to be used as a #! interpreterEelco Dolstra1-0/+37
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-07 nix-shell --command: Remove bogus argument to "exit"Eelco Dolstra1-1/+1
Fixes "exit: Inappropriate: numeric argument required" errors.
2014-12-05 Fix another operator precedence issue found by Perl 5.20Eelco Dolstra1-1/+1
2014-08-29 Shut up "Wide character" warnings in Perl scriptsEelco Dolstra1-0/+2
2014-08-20 Use proper quotes everywhereEelco Dolstra1-12/+12
2014-08-17 nix-build: Propagate exit status from nix-store -rEelco Dolstra1-1/+1
2014-08-13 nix-shell: Use $XDG_RUNTIME_DIREelco Dolstra1-1/+2
This prevents collisions with other users. Fixes #262.
2014-08-13 Use $XDG_RUNTIME_DIR for temporary filesEelco Dolstra1-3/+1
2014-05-26 nix-build: --add-root also takes 1 parameterAristid Breitkreuz1-1/+1
2014-04-08 nix-shell --pure: Keep the user's $PAGEREelco Dolstra1-1/+1
2014-03-30 Fix nix-shell for derivation with multiple outputsMaxim Ivanov1-0/+1
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-17 nix-build: Fix --cores flagEelco Dolstra1-1/+1
2014-02-19 nix-shell: Add --packages flagEelco Dolstra1-1/+11
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-19 nix-instantiate: Add a flag --expr / -E to read expressions from the command ↵Eelco Dolstra1-7/+15
line This is basically a shortcut for ‘echo 'expr...' | nix-instantiate -’. Also supported by nix-build and nix-shell.
2014-02-19 nix-shell: Don't leave a temporary directory in /tmp behindEelco Dolstra1-0/+1
2014-02-18 Add a flag ‘--check’ to verify build determinismEelco Dolstra1-0/+4
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-17 nix-shell: Execute shellHook if it existsEelco Dolstra1-0/+1
Since normal builds don't execute shellHook, this allows nix-shell specific customisation. Suggested by Domen.
2014-02-10 nix-shell: Use shell.nix as the default expression if it existsEelco Dolstra1-1/+2
2014-01-23 nix-shell: Add --impure flagEelco Dolstra1-3/+2
This is currently the default, but I might change that to --pure in the future.
2014-01-23 nix-shell: Preserve the TZ variable of the userEelco Dolstra1-2/+3
2014-01-23 nix-build: RefactorEelco Dolstra1-1/+1
2014-01-13 nix-shell: Don't set NIX_INDENT_MAKEEelco Dolstra1-0/+1
It generally is not useful in interactive environments (and messes up some non-ANSI-compliant terminals).
2014-01-13 nix-shell: Set $IN_NIX_SHELL before evaluatingEelco Dolstra1-2/+2
2014-01-06 Revert "nix-shell: Set $IN_NIX_SHELL before evaluation"Eelco Dolstra1-2/+2
This reverts commit 0c1198cf08576f16633b2344dc6513cefb567cfc.
2013-12-30 nix-shell --pure: Don't clear IN_NIX_SHELLShea Levy1-1/+1
Signed-off-by: Shea Levy <shea@shealevy.com>
2013-12-20 nix-shell: Don't warn about the lack of a GC rootEelco Dolstra1-1/+1
2013-12-20 nix-shell: Set $IN_NIX_SHELL before evaluationEelco Dolstra1-2/+2
This has some hacky applications.
2013-12-20 nix-shell: Handle --option correctlyEelco Dolstra1-1/+1
Fixes #181.
2013-12-17 nix-shell --pure: Keep $TERMEelco Dolstra1-1/+1
2013-10-18 Don't set $PS1 in non-interactive shellsEelco Dolstra1-1/+1
Shouldn't really matter, but you never know.
2013-10-18 nix-shell: Play nicely with non-interactive shellsShea Levy1-1/+3
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-14 nix-shell: Fix bash completionEelco Dolstra1-0/+1
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-06 nix-shell: Support a .drv as argumentEelco Dolstra1-8/+13
Fixes #161.
2013-07-31 nix-shell: Don't disable Automake dependency trackingEelco Dolstra1-1/+2
Nixpkgs' stdenv disables dependency tracking by default. That makes sense for one-time builds, but in an interactive environment we expect repeated "make" invocations to do the right thing.
2013-07-19 nix-shell: Set $IN_NIX_SHELLEelco Dolstra1-0/+2
This allows scripts to distinguish between a real build and a Nix shell.
2013-07-19 nix-shell: Set some environment variables also set by build.ccEelco Dolstra1-1/+3
Setting $NIX_STORE causes the purity checks in gcc/ld-wrapper to kick in, so that's why we unset $NIX_ENFORCE_PURITY.
2013-07-19 Rename ‘nix-build --run-env’ to ‘nix-shell’Eelco Dolstra1-7/+9
2013-07-19 nix-build --run-env: Add a ‘--pure’ flagEelco Dolstra1-2/+15
This causes the environment to be (almost) cleared, thus giving a shell that more closely resembled the actual Nix derivation.
2013-07-11 nix-build --run-env: Always use BashEelco Dolstra1-1/+1
Fixes #113. Fixes #131.
2013-07-11 nix-build --run-env: Source $stdenv/setup in the interactive shellEelco Dolstra1-8/+17
This ensures that not just environment variables are set, but also shell functions such as unpackPhase, configurePhase and so on.
2013-04-23 nix-build: Respect --timeoutEelco Dolstra1-1/+1
2012-11-26 Undo accidental debug changeEelco Dolstra1-1/+1
2012-11-26 Make "nix-build -A <derivation>.<output>" do the right thingEelco Dolstra1-3/+21
For example, given a derivation with outputs "out", "man" and "bin": $ nix-build -A pkg produces ./result pointing to the "out" output; $ nix-build -A pkg.man produces ./result-man pointing to the "man" output; $ nix-build -A pkg.all produces ./result, ./result-man and ./result-bin; $ nix-build -A pkg.all -A pkg2 produces ./result, ./result-man, ./result-bin and ./result-2.