aboutsummaryrefslogtreecommitdiff
path: root/src/nix-instantiate
AgeCommit message (Collapse)Author
2020-10-09Split out `local-fs-store.hh`John Ericson
This matches the already-existing `local-fs-store.cc`.
2020-10-06Remove static variable name clashesEelco Dolstra
This was useful for an experiment with building Nix as a single compilation unit. It's not very useful otherwise but also doesn't hurt...
2020-09-03addPermRoot(): Remove indirect flagEelco Dolstra
2020-09-03Remove the --indirect flagEelco Dolstra
All GC roots are now indirect.
2020-04-21remove 'format' from Error constructor callsBen Burdette
2020-03-30Remove global -I flagsEelco Dolstra
(cherry picked from commit 2c692a3b144523bca68dd6de618124ba6c9bb332)
2020-03-24findAlongAttrPath(): Return positionEelco Dolstra
(cherry picked from commit 0b013a54dc570395bed887369f8dd622b8ce337b)
2019-12-10Make the Store API more type-safeEelco Dolstra
Most functions now take a StorePath argument rather than a Path (which is just an alias for std::string). The StorePath constructor ensures that the path is syntactically correct (i.e. it looks like <store-dir>/<base32-hash>-<name>). Similarly, functions like buildPaths() now take a StorePathWithOutputs, rather than abusing Path by adding a '!<outputs>' suffix. Note that the StorePath type is implemented in Rust. This involves some hackery to allow Rust values to be used directly in C++, via a helper type whose destructor calls the Rust type's drop() function. The main issue is the dynamic nature of C++ move semantics: after we have moved a Rust value, we should not call the drop function on the original value. So when we move a value, we set the original value to bitwise zero, and the destructor only calls drop() if the value is not bitwise zero. This should be sufficient for most types. Also lots of minor cleanups to the C++ API to make it more modern (e.g. using std::optional and std::string_view in some places).
2018-10-26Merge all nix-* binaries into nixEelco Dolstra
These are all symlinks to 'nix' now, reducing the installed size by about ~1.7 MiB.
2018-06-12Move EvalState from the stack to the heapEelco Dolstra
EvalState contains a few counters (e.g. nrValues) that increase quickly enough that they end up being interpreted as pointers by the garbage collector. Moving it to the heap makes them invisible to the garbage collector. This reduces the max RSS doing 100 evaluations of nixos.tests.firefox.x86_64-linux.drvPath from 455 MiB to 292 MiB. Note: ideally, allocations would be much further up in the 64-bit address space to reduce the odds of an integer being misinterpreted as a pointer. Maybe we can use some linker magic to move the .bss segment to a higher address.
2018-03-16nix-shell: allow symlinks to .drvsLinus Heckemann
This makes persistent shell environments easier to use.
2018-02-08Add plugins to make Nix more extensible.Shea Levy
All plugins in plugin-files will be dlopened, allowing them to statically construct instances of the various Register* types Nix supports.
2018-01-16Add pure evaluation modeEelco Dolstra
In this mode, the following restrictions apply: * The builtins currentTime, currentSystem and storePath throw an error. * $NIX_PATH and -I are ignored. * fetchGit and fetchMercurial require a revision hash. * fetchurl and fetchTarball require a sha256 attribute. * No file system access is allowed outside of the paths returned by fetch{Git,Mercurial,url,Tarball}. Thus 'nix build -f ./foo.nix' is not allowed. Thus, the evaluation result is completely reproducible from the command line arguments. E.g. nix build --pure-eval '( let nix = fetchGit { url = https://github.com/NixOS/nixpkgs.git; rev = "9c927de4b179a6dd210dd88d34bda8af4b575680"; }; nixpkgs = fetchGit { url = https://github.com/NixOS/nixpkgs.git; ref = "release-17.09"; rev = "66b4de79e3841530e6d9c6baf98702aa1f7124e4"; }; in (import (nix + "/release.nix") { inherit nix nixpkgs; }).build.x86_64-linux )' The goal is to enable completely reproducible and traceable evaluation. For example, a NixOS configuration could be fully described by a single Git commit hash. 'nixos-rebuild' would do something like nix build --pure-eval '( (import (fetchGit { url = file:///my-nixos-config; rev = "..."; })).system ') where the Git repository /my-nixos-config would use further fetchGit calls or Git externals to fetch Nixpkgs and whatever other dependencies it has. Either way, the commit hash would uniquely identify the NixOS configuration and allow it to reproduced.
2017-10-24nix: Respect -I, --arg, --argstrEelco Dolstra
Also, random cleanup to argument handling.
2017-07-30Replace Unicode quotes in user-facing strings by ASCIIJörg Thalheim
Relevant RFC: NixOS/rfcs#4 $ ag -l | xargs sed -i -e "/\"/s/’/'/g;/\"/s/‘/'/g"
2017-07-26nix-build/nix-shell: Eliminate call to nix-instantiate / nix-storeEelco Dolstra
Note that this removes the need for a derivation symlink, so the --drv-path and --add-drv-link flags now do nothing.
2017-07-03Replace a few bool flags with enumsEelco Dolstra
Functions like copyClosure() had 3 bool arguments, which creates a severe risk of mixing up arguments. Also, implement copyClosure() using copyPaths().
2017-05-16Improve progress indicatorEelco Dolstra
2016-11-26Revert "Get rid of unicode quotes (#1140)"Eelco Dolstra
This reverts commit f78126bfd6b6c8477fcdbc09b2f98772dbe9a1e7. There really is no need for such a massive change...
2016-11-25Get rid of unicode quotes (#1140)Guillaume Maudoux
2016-06-02Allow setting the state directory as a store parameterEelco Dolstra
E.g. "local?store=/tmp/store&state=/tmp/var".
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-02-11Move addPermRoot into StoreEelco Dolstra
2016-02-04StoreAPI -> StoreEelco Dolstra
Calling a class an API is a bit redundant...
2016-02-04Eliminate the "store" global variableEelco Dolstra
Also, move a few free-standing functions into StoreAPI and Derivation. Also, introduce a non-nullable smart pointer, ref<T>, which is just a wrapper around std::shared_ptr ensuring that the pointer is never null. (For reference-counted values, this is better than passing a "T&", because the latter doesn't maintain the refcount. Usually, the caller will have a shared_ptr keeping the value alive, but that's not always the case, e.g., when passing a reference to a std::thread via std::bind.)
2015-10-29int2String() -> std::to_string()Eelco Dolstra
2015-07-17OCD: foreach -> C++11 ranged forEelco Dolstra
2015-05-06nix-env/nix-instantiate/nix-build: Support URIsEelco Dolstra
For instance, you can install Firefox from a specific Nixpkgs revision like this: $ nix-env -f https://github.com/NixOS/nixpkgs/archive/63def04891a0abc328b1b0b3a78ec02c58f48583.tar.gz -iA firefox Or build a package from the latest nixpkgs-unstable channel: $ nix-build https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz -A hello
2015-05-05Allow URLs in the Nix search pathEelco Dolstra
E.g. to install "hello" from the latest Nixpkgs: $ nix-build '<nixpkgs>' -A hello -I nixpkgs=https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz Or to install a specific version of NixOS: $ nixos-rebuild switch -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/63def04891a0abc328b1b0b3a78ec02c58f48583.tar.gz
2015-03-19Fix Boehm API violationEelco Dolstra
We were calling GC_INIT() after doing an allocation (in the baseEnv construction), which is not allowed.
2014-12-12Remove canary stuffEelco Dolstra
2014-09-22Rename strictForceValue -> forceValueDeepEelco Dolstra
2014-09-19Store Attrs inside BindingsEelco Dolstra
This prevents a double allocation per attribute set.
2014-09-17Add some instrumentation for debugging GC leaksEelco Dolstra
2014-08-20Use proper quotes everywhereEelco Dolstra
2014-08-13Refactor option handlingEelco Dolstra
2014-06-27Style fixEelco Dolstra
2014-06-27Add `--json` argument to `nix-instantiate`Paul Colomiets
2014-05-26Ensure that -I flags get included in nixPathEelco Dolstra
Also fixes #261.
2014-05-13nix-instantiate --eval: Apply auto-arguments if the result is a functionEelco Dolstra
Fixes #254.
2014-02-19nix-instantiate: Allow --dry-run as a synonym for --readonly-modeEelco Dolstra
--dry-run is more consistent with nix-env and nix-store.
2014-02-19nix-instantiate: Rename --eval-only to --eval, --parse-only to --parseEelco Dolstra
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-07nix-instantiate --eval-only --read-write-mode: Don't depend on orderingShea Levy
Signed-off-by: Shea Levy <shea@shealevy.com>
2014-02-07Rename --no-readonly-mode --read-write-modeShea Levy
Signed-off-by: Shea Levy <shea@shealevy.com>
2014-02-07nix-instantiate: Add a --no-readonly-mode flagShea Levy
This allows running nix-instantiate --eval-only without performing the evaluation in readonly mode, letting features like import from derivation and automatic substitution of builtins.storePath paths work. Signed-off-by: Shea Levy <shea@shealevy.com>
2014-02-01Remove AutomakefilesEelco Dolstra
2014-02-01Update Makefile variable namesEelco Dolstra
2014-01-30Rename Makefile -> local.mkEelco Dolstra
2014-01-09Update MakefilesEelco Dolstra