lix/src/libutil
Eelco Dolstra d4dcffd643
Add pure evaluation mode
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.
2018-01-16 19:23:18 +01:00
..
affinity.cc printMsg(lvlError, ...) -> printError(...) etc. 2016-09-21 16:54:53 +02:00
affinity.hh Run the daemon worker on the same CPU as the client 2013-08-07 14:02:04 +02:00
archive.cc builtins.fetchgit: Support importing a working tree 2017-10-30 19:59:25 +01:00
archive.hh builtins.fetchgit: Support importing a working tree 2017-10-30 19:59:25 +01:00
args.cc nix: Respect -I, --arg, --argstr 2017-10-24 12:58:34 +02:00
args.hh nix: Respect -I, --arg, --argstr 2017-10-24 12:58:34 +02:00
compression.cc use libbrotli directly when available 2017-12-30 20:26:33 -06:00
compression.hh LocalFSStore::getBuildLog(): Handle corrupted logs 2017-03-21 19:23:35 +01:00
config.cc Propagate flags like --sandbox to the daemon properly 2017-11-21 18:50:56 +01:00
config.hh Propagate flags like --sandbox to the daemon properly 2017-11-21 18:50:56 +01:00
finally.hh Add missing #include 2016-11-07 14:35:47 +01:00
hash.cc Replace Unicode quotes in user-facing strings by ASCII 2017-07-30 12:32:45 +01:00
hash.hh builtins.fetchgit: Support importing a working tree 2017-10-30 19:59:25 +01:00
istringstream_nocopy.hh Move istringstream_nocopy to a separate file 2017-03-21 14:43:03 +01:00
json.cc nix search: Add a cache 2017-07-26 17:29:10 +02:00
json.hh nix search: Add a cache 2017-07-26 17:29:10 +02:00
lazy.hh Figure out the user's home directory if $HOME is not set 2017-05-05 17:08:23 +02:00
local.mk use libbrotli directly when available 2017-12-30 20:26:33 -06:00
logging.cc logging.cc: add missing 'override' 2017-12-11 12:08:40 -06:00
logging.hh More progress indicator improvements 2017-10-24 14:47:23 +02:00
lru-cache.hh nix-daemon: Disable path info cache 2017-04-06 14:30:31 +02:00
monitor-fd.hh Fix interrupt handling 2017-01-26 20:40:33 +01:00
pool.hh RemoteStore: Add option to drop old connections from the pool 2017-09-14 18:10:38 +02:00
ref.hh Allow setting the state directory as a store parameter 2016-06-02 16:02:48 +02:00
serialise.cc readString(): Read directly into std::string 2017-03-01 14:54:11 +01:00
serialise.hh Pass all settings to build-remote 2017-10-23 20:50:28 +02:00
sync.hh Include missing <cstdlib> for abort() 2017-08-03 07:03:22 +10:00
thread-pool.cc Fix a hang in ThreadPool 2017-10-09 15:41:09 +02:00
thread-pool.hh Fix a hang in ThreadPool 2017-10-09 15:41:09 +02:00
types.hh Progress indicator: Show number of active items 2017-08-16 20:56:03 +02:00
util.cc Add pure evaluation mode 2018-01-16 19:23:18 +01:00
util.hh Add pure evaluation mode 2018-01-16 19:23:18 +01:00
xml-writer.cc OCD: foreach -> C++11 ranged for 2015-07-17 20:13:56 +02:00
xml-writer.hh And another one 2014-02-26 18:55:18 +01:00