aboutsummaryrefslogtreecommitdiff
path: root/src/nix
AgeCommit message (Collapse)Author
2019-09-02Improve error message when a directory is not a flakeEelco Dolstra
So you now get $ nix build error: path '.' is not a flake (because it does not reference a Git repository) rather than $ nix build error: unsupported argument '.'
2019-09-02nix dev-shell --profile: Support relative pathEelco Dolstra
2019-08-30Remove 'name' attribute from flakesEelco Dolstra
This is no longer needed since flakes are given an identity in the 'inputs' attribute.
2019-08-30Turn flake inputs into an attrsetEelco Dolstra
Instead of a list, inputs are now an attrset like inputs = { nixpkgs.uri = github:NixOS/nixpkgs; }; If 'uri' is omitted, than the flake is a lookup in the flake registry, e.g. inputs = { nixpkgs = {}; }; but in that case, you can also just omit the input altogether and specify it as an argument to the 'outputs' function, as in outputs = { self, nixpkgs }: ... This also gets rid of 'nonFlakeInputs', which are now just a special kind of input that have a 'flake = false' attribute, e.g. inputs = { someRepo = { uri = github:example/repo; flake = false; }; };
2019-08-29Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2019-08-27Merge branch 'test-sandboxing' of https://github.com/matthewbauer/nixEelco Dolstra
2019-08-09nix dev-shell: Set dontAddDisableDepTrackEelco Dolstra
2019-08-08Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2019-08-02Add a post-build-hookregnat
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-26nix dev-shell: Set IN_NIX_SHELL in the derivationEelco Dolstra
This ensures that stdenv / setup hooks take $IN_NIX_SHELL into account. For example, stdenv only sets NIX_SSL_CERT_FILE=/no-cert-file.crt if we're not in a shell.
2019-07-25Disable CLONE_NEWUSER when it’s unavailableMatthew Bauer
Some kernels disable "unpriveleged user namespaces". This is unfortunate, but we can still use mount namespaces. Anyway, since each builder has its own nixbld user, we already have most of the benefits of user namespaces.
2019-07-12nix dev-shell: Make it possible to enter a profileEelco Dolstra
For example: $ nix dev-shell --profile /tmp/my-shell dwarffs (later) $ nix dev-shell /tmp/my-shell
2019-07-12Refactor a bitEelco Dolstra
2019-07-12nix dev-shell: Add --profile flagEelco Dolstra
This is useful to prevent the shell environment from being garbage-collected.
2019-07-12nix build: Add '--profile' flagEelco Dolstra
This replaces 'nix-env --set'. For example: $ nix build --profile /nix/var/nix/profiles/system \ ~/Misc/eelco-configurations:nixosConfigurations.vyr.config.system.build.toplevel updates the NixOS system profile from a flake. This could have been a separate command (e.g. 'nix set-profile') but 1) '--profile' is pretty similar to '--out-link'; and 2) '--profile' could be useful for other command (like 'nix dev-shell').
2019-07-11Rename 'epoch' -> 'edition'Eelco Dolstra
2019-07-11Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2019-07-10nix copy: Rename --substitute to --substitute-on-destinationEelco Dolstra
'--substitute' was being shadowed by the regular '--substitute' (the short-hand for '--option substitute true'). Fixes #2983.
2019-07-06Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2019-07-03Get BOOST_LDFLAGS from autoconf, fix Ubuntu 16.04 build.Niklas Hambüchen
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-03Fix C++ compatibility with older editline versions.Niklas Hambüchen
For example, Ubuntu 16.04 and many similar long-term-support distros have older versions.
2019-06-28Fix macOS build failureEelco Dolstra
Issue #2976.
2019-06-26Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2019-06-25ProgressBar: Fix updatingEelco Dolstra
'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-25Automatically use --no-net if there are no network interfacesEelco Dolstra
(cherry picked from commit 04a59769963fe2a28d10ba15de743fe499333c80)
2019-06-25Add "warning" verbosity levelEelco Dolstra
This ensures that "nix" shows warnings. Previously these were hidden because they were at "info" level. (cherry picked from commit 615a9d031d22a6aee64f8511e15685e47b6f8796)
2019-06-23nix doctor: Fix typoEelco Dolstra
2019-06-21Simplify getFlake() / fetchFlake() logicEelco Dolstra
2019-06-21Handle store symlinks in flake directoriesEelco Dolstra
E.g. 'nix path-info ./result' inside a flake directory now works again.
2019-06-18Make subcommand construction in MultiCommand lazyEelco Dolstra
2019-06-18Merge pull request #2951 from NixOS/app-improvementsEelco Dolstra
App / check improvements
2019-06-18Merge pull request #2917 from CSVdB/docsEelco Dolstra
Updated flake documentation
2019-06-18Merge pull request #2949 from NixOS/no-netEelco Dolstra
Add --no-net flag
2019-06-18Updated documentationEelco Dolstra
2019-06-18nix flake check: Ignore legacyPackagesEelco Dolstra
2019-06-17nix flake check: Warn about unknown flake outputsEelco Dolstra
2019-06-17nix flake check: Check appsEelco Dolstra
2019-06-17nix flake info --json: Revive enumerating the outputsEelco Dolstra
2019-06-17nix app: Accept argumentsEelco Dolstra
Example: $ nix app blender-bin -- --version Blender 2.80 (sub 74)
2019-06-17nix app: Search for installable in the 'apps' outputEelco Dolstra
I.e. you can write $ nix app blender-bin:blender_2_80 which is equivalent to $ nix app blender-bin:apps.blender_2_80
2019-06-17Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2019-06-17Automatically use --no-net if there are no network interfacesEelco Dolstra
2019-06-17Add "warning" verbosity levelEelco Dolstra
This ensures that "nix" shows warnings. Previously these were hidden because they were at "info" level.
2019-06-15nix: Add -L alias for --print-build-logsEelco Dolstra
2019-06-13For nixpkgs.<attr>, use legacyPackagesEelco Dolstra
This makes commands like 'nix run nixpkgs.chromium' work again.
2019-06-07Add flake evaluation cacheEelco Dolstra
This exploits the hermetic nature of flake evaluation to speed up repeated evaluations of a flake output attribute. For example (doing 'nix build' on an already present package): $ time nix build nixpkgs:firefox real 0m1.497s user 0m1.160s sys 0m0.139s $ time nix build nixpkgs:firefox real 0m0.052s user 0m0.038s sys 0m0.007s The cache is ~/.cache/nix/eval-cache-v1.sqlite, which has entries like INSERT INTO Attributes VALUES( X'92a907d4efe933af2a46959b082cdff176aa5bfeb47a98fabd234809a67ab195', 'packages.firefox', 1, '/nix/store/pbalzf8x19hckr8cwdv62rd6g0lqgc38-firefox-67.0.drv /nix/store/g6q0gx0v6xvdnizp8lrcw7c4gdkzana0-firefox-67.0 out'); where the hash 92a9... is a fingerprint over the flake store path and the contents of the lockfile. Because flakes are evaluated in pure mode, this uniquely identifies the evaluation result.
2019-06-05Move flake-related stuff to src/libexpr/flakeEelco Dolstra
2019-06-04Make non-flake inputs lazyEelco Dolstra
Also add a proper test for non-flake inputs.
2019-06-04Don't register invalid paths as GC rootsEelco Dolstra
Unfortunately this doesn't work. Maybe we should keep separate roots for each path.
2019-06-04Rename dep -> inputEelco Dolstra
Also use nlohmann::json range-based for.