about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorFilesLines
2019-08-02 Add a post-build-hookregnat13-4/+333
Passing `--post-build-hook /foo/bar` to a nix-* command will cause `/foo/bar` to be executed after each build with the following environment variables set: DRV_PATH=/nix/store/drv-that-has-been-built.drv OUT_PATHS=/nix/store/...build /nix/store/...build-bin /nix/store/...build-dev This can be useful in particular to upload all the builded artifacts to the cache (including the ones that don't appear in the runtime closure of the final derivation or are built because of IFD). This new feature prints the stderr/stdout output to the `nix-build` and `nix build` client, and the output is printed in a Nix 2 compatible format: [nix]$ ./inst/bin/nix-build ./test.nix these derivations will be built: /nix/store/ishzj9ni17xq4hgrjvlyjkfvm00b0ch9-my-example-derivation.drv building '/nix/store/ishzj9ni17xq4hgrjvlyjkfvm00b0ch9-my-example-derivation.drv'... hello! bye! running post-build-hook '/home/grahamc/projects/github.com/NixOS/nix/post-hook.sh'... post-build-hook: + sleep 1 post-build-hook: + echo 'Signing paths' /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation post-build-hook: Signing paths /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation post-build-hook: + sleep 1 post-build-hook: + echo 'Uploading paths' /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation post-build-hook: Uploading paths /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation post-build-hook: + sleep 1 post-build-hook: + printf 'very important stuff' /nix/store/qr213vjmibrqwnyp5fw678y7whbkqyny-my-example-derivation [nix-shell:~/projects/github.com/NixOS/nix]$ ./inst/bin/nix build -L -f ./test.nix my-example-derivation> hello! my-example-derivation> bye! my-example-derivation (post)> + sleep 1 my-example-derivation (post)> + echo 'Signing paths' /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation my-example-derivation (post)> Signing paths /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation my-example-derivation (post)> + sleep 1 my-example-derivation (post)> + echo 'Uploading paths' /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation my-example-derivation (post)> Uploading paths /nix/store/c263gzj2kb2609mz8wrbmh53l14wzmfs-my-example-derivation my-example-derivation (post)> + sleep 1 my-example-derivation (post)> + printf 'very important stuff' [1 built, 0.0 MiB DL] Co-authored-by: Graham Christensen <graham@grahamc.com> Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2019-07-13 Merge pull request #2975 from matthewbauer/fix-nsswitch-issueEelco Dolstra1-1/+7
Don’t use entire /etc/nsswitch.conf file
2019-07-10 Resume NAR downloadsEelco Dolstra1-7/+28
This is a much simpler fix to the 'error 9 while decompressing xz file' problem than 78fa47a7f08a4cb6ee7061bf0bd86a40e1d6dc91. We just do a ranged HTTP request starting after the data that we previously wrote into the sink. Fixes #2952, #379.
2019-07-10 HttpBinaryCacheStore: Use default number of retries for NARsEelco Dolstra1-1/+0
2019-07-10 Downloader: Use warn()Eelco Dolstra1-3/+3
2019-07-10 Revert "Fix 'error 9 while decompressing xz file'"Eelco Dolstra7-162/+125
This reverts commit 78fa47a7f08a4cb6ee7061bf0bd86a40e1d6dc91.
2019-07-10 nix copy: Rename --substitute to --substitute-on-destinationEelco Dolstra1-1/+1
'--substitute' was being shadowed by the regular '--substitute' (the short-hand for '--option substitute true'). Fixes #2983.
2019-07-06 Merge pull request #2882 from grahamc/docs/1115-tarball-ttlEelco Dolstra2-2/+27
tarball-ttl: document
2019-07-05 tarball-ttl: documentGraham Christensen2-2/+27
Incorporates text from Niklas Hambüchen in #2978 Closes #1115
2019-07-05 Revert 82b7f0e840983879a510245903ff7c917276f65d, ↵Eelco Dolstra1-32/+4
cd8bc06e8786018ddb16cea4cb10971b63d0efd2, c3db9e6f8fd06d691be04cdd95a6bb21a400481d This breaks the tarball job: https://hydra.nixos.org/build/95714570
2019-07-03 Merge branch 'autoconf-ubuntu-16.04-fixes' of https://github.com/nh2/nixEelco Dolstra13-41/+1077
2019-07-03 autoconf: Implement release tarball detection. Fixes #257.Niklas Hambüchen1-7/+20
This should finally allow us to address all cases of build errors due to differences between release tarballs and building from git. See also https://github.com/NixOS/nix/issues/506#issuecomment-507312587
2019-07-03 autoconf: Add comment on use of `false`.Niklas Hambüchen1-3/+9
This is to avoid confusion as in commit a0d29040f79b365598fe75d01f72d29ab538206b.
2019-07-03 autoconf: Check if --nonet works. Fixes #967 #506.Niklas Hambüchen1-0/+9
Also give a helpful error message on what package the user likely has to install to make it work.
2019-07-03 Get BOOST_LDFLAGS from autoconf, fix Ubuntu 16.04 build.Niklas Hambüchen4-2/+6
Our use of boost::coroutine2 depends on -lboost_context, which in turn depends on `-lboost_thread`, which in turn depends on `-lboost_system`. I suspect that this builds on nix only because of low-level hacks like NIX_LDFLAGS. This commit passes the proper linker flags, thus fixing bootstrap builds on non-nix distributions like Ubuntu 16.04. With these changes, I can build Nix on Ubuntu 16.04 using: ./bootstrap.sh ./configure --prefix=$HOME/editline-prefix \ --disable-doc-gen \ CXX=g++-7 \ --with-boost=$HOME/boost-prefix \ EDITLINE_CFLAGS=-I$HOME/editline-prefix/include \ EDITLINE_LIBS=-leditline \ LDFLAGS=-L$HOME/editline-prefix/lib make where * g++-7 comes from gcc-7 from https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test, * editline 1.14 from https://github.com/troglobit/editline/releases/tag/1.14.0 was installed into `$HOME/editline-prefix` (because Ubuntu 16.04's `editline` is too old to have the function nix uses), * boost 1.66 from https://www.boost.org/doc/libs/1_66_0/more/getting_started/unix-variants.html was installed into $HOME/boost-prefix (because Ubuntu 16.04 only has 1.58)
2019-07-03 Fix C++ compatibility with older editline versions.Niklas Hambüchen1-0/+7
For example, Ubuntu 16.04 and many similar long-term-support distros have older versions.
2019-07-03 Makefile.config.in: Remove HAVE_READLINE.Niklas Hambüchen1-1/+0
It was forgotten to be removed with commit c5f23f10a84f568874321c04984b1a14d2dce978 and so it until now stayed unsubstituted as `HAVE_READLINE = @HAVE_READLINE@` in Makefile.config.
2019-07-03 autoconf: Allow overriding CFLAGS/CXXFLAGS from outside.Niklas Hambüchen4-18/+8
As is normal for autoconf-based projects. For example, it is a common use case to do ./configure CXXFLAGS=-O0 This did not work for nix until now, because the `CXXFLAGS=` declaration would unconditionally erase what the user had specified. The custom `OPTIMIZE` flag is removed, but the default `-O3` is retained; autoconf would default to `-g -O2` by default otherwise as documented on: https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/C-Compiler.html https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/C_002b_002b-Compiler.html
2019-07-03 autoconf: Fix AC_STRUCT_DIRENT_D_TYPE being used before AC_PROG_CC.Niklas Hambüchen1-8/+8
That was incorrect, because checking the dirent type already requires a working compiler. It had the effect that setting e.g. `: ${CFLAGS=""}` before `AC_PROG_CC` as per `AC_PROG_CC`'s documentation would have no effect, because `AC_STRUCT_DIRENT_D_TYPE` would automatically set CFLASGS. (In a followup commit `: ${CFLAGS=""}` will be used, so it's important to get this working first.)
2019-07-03 mk: add support for passing LDFLAGS to libs and binsSergei Trofimovich3-4/+5
autotools-based systems usually allow user to append own LDFLAGS like LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu" at ./configure stage This change plumbs LDFLAGS through similar to existing CXXFLAGS variable. Signed-off-by: Sergei Trofimovich <siarheit@google.com>
2019-07-03 autoconf: Fix C++17 detection not working on Ubuntu 16.04.Niklas Hambüchen4-2/+989
And probably many other distributions. Until now, ./configure would fail silently printing a warning ./configure: line 4621: AX_CXX_COMPILE_STDCXX_17: command not found and then continuing, later failing with a C++ #error saying that some C++11 feature isn't supported (it didn't even get to the C++17 features). This is because older distributions don't come with the `AX_CXX_COMPILE_STDCXX_17` m4 macro. This commit vendors that macro accordingly. Now ./configure complains correctly: configure: error: *** A compiler with support for C++17 language features is required. On Ubuntu 16.04, ./configure completes if a newer compiler is used, e.g. with gcc-7 from https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test using: ./bootstrap.sh ./configure CXX=g++-7 --disable-doc-gen --with-boost=$(nix-build --no-link '<nixpkgs>' -A boost.dev)
2019-07-03 autoconf: Work around editline not being found on Ubuntu 16.04.Niklas Hambüchen2-1/+14
And probably other Linux distributions with long-term support releases. Also update manual stating what version is needed; I checked that 1.14 is the oldest version with which current nix compiles, and added autoconf feature checks for some functions added in that release that nix uses.
2019-07-03 autoconf: Detect boost, require version, set CXXFLAGS.Niklas Hambüchen1-0/+7
This turns previous compiler errors complaining about missing files into proper ./configure time errors telling the user which version of boost is required.
2019-07-03 autoconf: Change quotes in description.Niklas Hambüchen1-1/+1
The unbalanced single-quotes cause many editor syntax highlighters to interpret the rest of the file as a string literal, making it easier to make syntax mistakes in absence of proper highlighting.
2019-07-02 Merge pull request #2779 from LnL7/build-exit-codesEelco Dolstra6-12/+111
build: add exit code for hash and check mismatches
2019-07-02 timeout: test for error codeGraham Christensen1-4/+8
2019-07-02 Merge pull request #2974 from grahamc/invalid-nameEelco Dolstra1-3/+10
checkStoreName: give more precise/verbose error information
2019-07-02 Merge pull request #2724 from LnL7/manpage-add-fixedEelco Dolstra1-0/+54
nix-store: document --add-fixed
2019-07-02 Merge pull request #2582 from LnL7/fetchgit-refsEelco Dolstra4-1/+43
fetchGit: allow fetching explicit refs
2019-07-02 nix-store: document --add-fixedDaiderd Jordan1-0/+54
2019-07-02 builtins.fetchGit: document absolute ref supportGraham Christensen3-0/+38
2019-07-02 checkStoreName: give more precise/verbose error informationGraham Christensen1-3/+10
$ sudo ./inst/bin/nix-instantiate -E '"${./.git}"' error: The path name '.git' is invalid: it is illegal to start the name with a period. Path names are alphanumeric and can include the symbols +-._?= and must not begin with a period. Note: If '.git' is a source file and you cannot rename it on disk, builtins.path { name = ... } can be used to give it an alternative name.
2019-07-02 build: replace 100 offset for build exit codesDaiderd Jordan3-9/+30
2019-07-02 nix-store: document exit codesDaiderd Jordan1-0/+35
2019-07-02 build: add tests for --check status codesDaiderd Jordan2-4/+24
2019-07-02 build: use binary mask for build status flagsDaiderd Jordan1-1/+9
If multiple builds with fail with different errors it will be reflected in the status code. eg. 103 => timeout + hash mismatch 105 => timeout + check mismatch 106 => hash mismatch + check mismatch 107 => timeout + hash mismatch + check mismatch
2019-07-02 build: add exit code for hash and check mismatchesDaiderd Jordan2-4/+15
Makes it easier to identify the failure reason in other tooling, eg. differentiate between a non-deterministic --check vs a failed build. $ nix-build '<nix/fetchurl.nix>' --argstr url http://example.org --argstr sha256 0000000000000000000000000000000000000000000000000000 hash mismatch in fixed-output derivation '/nix/store/nzi9ck45rwlxzcwr25is7qlf3hs5xl83-example.org': wanted: sha256:0000000000000000000000000000000000000000000000000000 got: sha256:08y4734bm2zahw75b16bcmcg587vvyvh0n11gwiyir70divwp1rm $ echo $? 102 $ nix-build -E 'with import <nixpkgs> {}; runCommand "foo" {} "date +%s > $out"' --check warning: rewriting hashes in '/nix/store/g3k47g0399fvjmbm0p0mnad74k4w8vkz-foo'; cross fingers error: derivation '/nix/store/mggc8dz13ackb49qca6m23zq4fpq132q-foo.drv' may not be deterministic: output '/nix/store/g3k47g0399fvjmbm0p0mnad74k4w8vkz-foo' differs $ echo $? 104
2019-06-28 Merge pull request #2977 from aniketd/2971-cannot-disable-http2Eelco Dolstra1-0/+2
Fix `http2 = false` having no effect.
2019-06-28 Fix `http2 = false` having no effect. Fixes #2971.Aniket Deshpande1-0/+2
Setting `http2 = false` in nix config (e.g. /etc/nix/nix.conf) had no effect, and `nix-env -vvvvv -i hello` still downloaded .nar packages using HTTP/2. In `src/libstore/download.cc`, the `CURL_HTTP_VERSION_2TLS` option was being explicitly set when `downloadSettings.enableHttp2` was `true`, but, `CURL_HTTP_VERSION_1_1` option was not being explicitly set when `downloadSettings.enableHttp2` was `false`. This may be because `https://curl.haxx.se/libcurl/c/libcurl-env.html` states: "You have to set this option if you want to use libcurl's HTTP/2 support." but, also, in the changelog, states: "DEFAULT Since curl 7.62.0: CURL_HTTP_VERSION_2TLS Before that: CURL_HTTP_VERSION_1_1" So, the default setting for `libcurl` is HTTP/2 for version >= 7.62.0. In this commit, option `CURLOPT_HTTP_VERSION` is explicitly set to `CURL_HTTP_VERSION_1_1` when `downloadSettings.enableHttp2` nix config setting is `false`. This can be tested by running `nix-env -vvvvv -i hello | grep HTTP`
2019-06-28 Fix macOS build failureEelco Dolstra1-2/+2
Issue #2976.
2019-06-27 Don’t use entire /etc/nsswitch.conf fileMatthew Bauer1-1/+7
The default nsswitch.conf(5) file in most distros can handle many different things including host name, user names, groups, etc. In Nix, we want to limit the amount of impurities that come from these things. As a result, we should only allow nss to be used for gethostbyname(3) and getservent(3). /cc @Ericson2314
2019-06-25 ProgressBar: Fix updatingEelco Dolstra1-11/+15
'updateCV.notify_one()' does nothing if the update thread is not waiting for updateCV (in particular this happens when it is sleeping on quitCV). So also set a variable to ensure that the update isn't lost.
2019-06-25 nix-channel: Don't fetch binary-cache-urlEelco Dolstra4-35/+8
This has been ignored since the Perl->C++ rewrite.
2019-06-25 Automatically use --no-net if there are no network interfacesEelco Dolstra2-11/+55
(cherry picked from commit 04a59769963fe2a28d10ba15de743fe499333c80)
2019-06-25 Add "warning" verbosity levelEelco Dolstra3-2/+4
This ensures that "nix" shows warnings. Previously these were hidden because they were at "info" level. (cherry picked from commit 615a9d031d22a6aee64f8511e15685e47b6f8796)
2019-06-24 Fix 32-bit overflow with --no-netEelco Dolstra3-10/+7
--no-net causes tarballTtl to be set to the largest 32-bit integer, which causes comparison like 'time + tarballTtl < other_time' to fail on 32-bit systems. So cast them to 64-bit first. https://hydra.nixos.org/build/95076624 (cherry picked from commit 29ccb2e9697ee2184012dd13854e487928ae4441)
2019-06-24 Refactor downloadCached() interfaceEelco Dolstra6-49/+63
(cherry picked from commit df3f5a78d5ab0a1f2dc9d288b271b38a9b8b33b5)
2019-06-24 Add '--no-net' convenience flagEelco Dolstra5-20/+35
This flag * Disables substituters. * Sets the tarball-ttl to infinity (ensuring e.g. that the flake registry and any downloaded flakes are considered current). * Disables retrying downloads and sets the connection timeout to the minimum. (So it doesn't completely disable downloads at the moment.) (cherry picked from commit 8ea842260b4fd93315d35c5ba94b1ff99ab391d8)
2019-06-24 Fix 'error 9 while decompressing xz file'Eelco Dolstra7-125/+162
Once we've started writing data to a Sink, we can't restart a download request, because then we end up writing duplicate data to the Sink. Therefore we shouldn't handle retries in Downloader but at a higher level (in particular, in copyStorePath()). Fixes #2952. (cherry picked from commit a67cf5a3585c41dd9f219a2c7aa9cf67fa69520b)
2019-06-24 Downloader: Propagate exceptions from decompressionSink->finish()Eelco Dolstra1-2/+7
(cherry picked from commit 15fa70cd1b853f5e62662b99ccb9ef3da6cfadff)