aboutsummaryrefslogtreecommitdiff
path: root/scripts/nix-build.in
AgeCommit message (Collapse)Author
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.
2013-07-31nix-shell: Don't disable Automake dependency trackingEelco Dolstra
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-19nix-shell: Set $IN_NIX_SHELLEelco Dolstra
This allows scripts to distinguish between a real build and a Nix shell.
2013-07-19nix-shell: Set some environment variables also set by build.ccEelco Dolstra
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-19Rename ‘nix-build --run-env’ to ‘nix-shell’Eelco Dolstra
2013-07-19nix-build --run-env: Add a ‘--pure’ flagEelco Dolstra
This causes the environment to be (almost) cleared, thus giving a shell that more closely resembled the actual Nix derivation.
2013-07-11nix-build --run-env: Always use BashEelco Dolstra
Fixes #113. Fixes #131.
2013-07-11nix-build --run-env: Source $stdenv/setup in the interactive shellEelco Dolstra
This ensures that not just environment variables are set, but also shell functions such as unpackPhase, configurePhase and so on.
2013-04-23nix-build: Respect --timeoutEelco Dolstra
2012-11-26Undo accidental debug changeEelco Dolstra
2012-11-26Make "nix-build -A <derivation>.<output>" do the right thingEelco Dolstra
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.
2012-10-03When ‘--help’ is given, just run ‘man’ to show the manual pageEelco Dolstra
I.e. do what git does. I'm too lazy to keep the builtin help text up to date :-) Also add ‘--help’ to various commands that lacked it (e.g. nix-collect-garbage).
2012-10-03nix-build: Support ‘--repair’ flagEelco Dolstra
2012-08-27Merge branch 'master' into no-manifestsEelco Dolstra
2012-08-24Include the output name in the GC root linkEelco Dolstra
Output names are now appended to resulting GC symlinks, e.g. by nix-build. For backwards compatibility, if the output is named "out", nothing is appended. E.g. doing "nix-build -A foo" on a derivation that produces outputs "out", "bin" and "dev" will produce symlinks "./result", "./result-bin" and "./result-dev", respectively.
2012-07-26Merge branch 'master' into no-manifestsEelco Dolstra