fix/src/libexpr
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
..
primops Add pure evaluation mode 2018-01-16 19:23:18 +01:00
attr-path.cc Replace Unicode quotes in user-facing strings by ASCII 2017-07-30 12:32:45 +01:00
attr-path.hh Work on Values instead of Exprs 2013-09-03 13:17:51 +00:00
attr-set.cc Optimize empty sets 2015-07-23 23:11:08 +02:00
attr-set.hh Bindings: Add a method for iterating in lexicographically sorted order 2017-01-26 20:40:33 +01:00
common-eval-args.cc nix: Respect -I, --arg, --argstr 2017-10-24 12:58:34 +02:00
common-eval-args.hh Fix build 2017-11-01 21:32:30 +01:00
eval-inline.hh Restore thunks on any exception 2017-06-20 12:13:17 +02:00
eval.cc Add pure evaluation mode 2018-01-16 19:23:18 +01:00
eval.hh Add pure evaluation mode 2018-01-16 19:23:18 +01:00
get-drvs.cc nix-shell/nix-build: Support .drv files again 2017-11-24 18:08:35 +01:00
get-drvs.hh nix-shell/nix-build: Support .drv files again 2017-11-24 18:08:35 +01:00
json-to-value.cc json-to-value: Throw sensible error message on invalid numbers 2017-12-14 19:09:45 -05:00
json-to-value.hh Add builtin function ‘fromJSON’ 2014-07-04 13:34:15 +02:00
lexer.l Revert "Don't parse "x:x" as a URI" 2017-11-14 15:10:52 +01:00
local.mk Shut up some warnings 2017-04-14 14:42:20 +02:00
names.cc replace own regex class with std::regex 2016-10-18 20:22:25 +02:00
names.hh replace own regex class with std::regex 2016-10-18 20:22:25 +02:00
nix-expr.pc.in Install some pkgconfig files 2014-09-18 12:00:40 +02:00
nixexpr.cc Replace Unicode quotes in user-facing strings by ASCII 2017-07-30 12:32:45 +01:00
nixexpr.hh Replace Unicode quotes in user-facing strings by ASCII 2017-07-30 12:32:45 +01:00
parser.y Remove git:// support in NIX_PATH 2017-11-03 13:55:31 +01:00
primops.cc Add pure evaluation mode 2018-01-16 19:23:18 +01:00
primops.hh Make primop registration pluggable 2016-04-14 12:50:01 +02:00
symbol-table.hh Include config.h implicitly with '-include config.h' in CFLAGS 2017-02-08 21:51:02 +02:00
value-to-json.cc nix path-info: Add --json flag 2016-08-29 17:29:24 +02:00
value-to-json.hh nix path-info: Add --json flag 2016-08-29 17:29:24 +02:00
value-to-xml.cc First hit at providing support for floats in the language. 2016-01-05 00:40:40 +01:00
value-to-xml.hh Use "#pragma once" to prevent repeated header file inclusion 2012-07-18 14:59:03 -04:00
value.hh Restructure installables handling in the "nix" command 2017-04-25 11:20:37 +02:00