regnat
af99941279
Make experimental-features a proper type
...
Rather than having them plain strings scattered through the whole
codebase, create an enum containing all the known experimental features.
This means that
- Nix can now `warn` when an unkwown experimental feature is passed
(making it much nicer to spot typos and spot deprecated features)
- It’s now easy to remove a feature altogether (once the feature isn’t
experimental anymore or is dropped) by just removing the field for the
enum and letting the compiler point us to all the now invalid usages
of it.
2021-10-26 07:02:31 +02:00
Ben Burdette
cbc2f0fe31
remove dead code
2021-10-22 14:02:47 -06:00
Ben Burdette
98eb13691a
print staticenv bindings
2021-10-11 16:32:43 -06:00
Ben Burdette
2ee1fa4afd
add nullable Expr argument
2021-10-11 14:42:29 -06:00
Eelco Dolstra
d39692e6b3
Make builtins.{path,filterSource} work with chroot stores
2021-10-07 14:22:39 +02:00
Eelco Dolstra
cfaad7168e
Refactoring: Add allowPath() method
2021-10-07 12:11:00 +02:00
Maximilian Bosch
2b02ce0e48
libexpr: throw a more helpful eval-error if a builtin is not available due to a missing feature-flag
...
I found it somewhat confusing to have an error like
error: attribute 'getFlake' missing
if the required experimental-feature (`flakes`) is not enabled. Instead,
I'd expect Nix to throw an error just like it's the case when using e.g. `nix
flake` without `flakes` being enabled.
With this change, the error looks like this:
$ nix-instantiate -E 'builtins.getFlake "nixpkgs"'
error: Cannot call 'builtins.getFlake' because experimental Nix feature 'flakes' is disabled. You can enable it via '--extra-experimental-features flakes'.
at «string»:1:1:
1| builtins.getFlake "nixpkgs"
| ^
I didn't use `settings.requireExperimentalFeature` here on purpose
because this doesn't contain a position. Also, it doesn't seem as if we
need to catch the error and check for the missing feature here since
this already happens at evaluation time.
2021-09-29 11:57:15 +02:00
Ben Burdette
21071bfdeb
shared_ptr for StaticEnv
2021-09-14 10:49:22 -06:00
Ben Burdette
176911102c
printEnvPosChain
2021-09-13 11:57:25 -06:00
Eelco Dolstra
49a932fb18
nix --help: Display help using lowdown instead of man
...
Fixes #4476 .
Fixes #5231 .
2021-09-13 14:45:21 +02:00
Eelco Dolstra
7ee639f9db
Merge pull request #5066 from Radvendii/master
...
add antiquotations to paths
2021-09-01 12:55:04 +02:00
Taeer Bar-Yam
9da8f5e25d
path antiquotations: canonizePath -> canonicalizePath
2021-08-31 08:02:04 -04:00
Eelco Dolstra
323cafcb4e
Merge pull request #5191 from hercules-ci/evalstate-lifetime-hygiene
...
EvalState lifetime hygiene
2021-08-30 12:23:09 +02:00
Robert Hensing
8656b130ea
Fix use after free with vImportedDrvToDerivation
2021-08-29 20:42:57 +02:00
Robert Hensing
8bc76acc7c
Move vCallFlake into EvalState
...
This fixes a use-after-free bug:
1. s = new EvalState();
2. callFlake()
3. static vCallFlake now references s
4. delete s;
5. s2 = new EvalState();
6. callFlake()
7. static vCallFlake still references s
8. crash
Nix 2.3 did not have a problem with recreating EvalState.
2021-08-29 20:42:49 +02:00
Robert Hensing
f10465774f
Force all Pos* to be non-null
...
This fixes a class of crashes and introduces ptr<T> to make the
code robust against this failure mode going forward.
Thanks regnat for the idea of a ref<T> without overhead!
Closes #4895
Closes #4893
Closes #5127
Closes #5113
2021-08-29 18:11:58 +02:00
Ben Burdette
310c689d31
remove more explicit valmap code
2021-08-25 13:18:27 -06:00
Ben Burdette
bd3b5329f9
print env bindings
2021-08-24 16:32:54 -06:00
Ben Burdette
4b5f9b35f0
env to bindings
2021-08-18 21:25:26 -06:00
Ben Burdette
89264d20e6
move valmap to hh; add to env
2021-08-06 11:09:27 -06:00
Taeer Bar-Yam
8f9429dcab
add antiquotations to paths
2021-08-06 06:46:05 -04:00
Eelco Dolstra
c000cec27f
Merge pull request #5048 from tweag/flox-eval-store
...
--eval-store and faster closure copying
2021-07-27 12:20:32 +02:00
Eelco Dolstra
bef40c2949
Add --eval-store option
2021-07-22 09:59:51 +02:00
Pamplemousse
c1c5dd7449
Avoid global counters
...
Signed-off-by: Pamplemousse <xav.maso@gmail.com>
2021-07-21 16:49:52 -07:00
Eelco Dolstra
75efa42134
Move <nix/fetchurl.nix> into the nix binary
...
This makes the statically linked nix binary just work, without needing
any additional files.
2020-12-22 14:43:20 +01:00
Eelco Dolstra
e8e1d420f3
Don't include <regex> in header files
...
This reduces compilation time by ~15 seconds (CPU time).
Issue #4045 .
2020-09-21 18:22:45 +02:00
Eelco Dolstra
f53b5f1058
Add getDoc() function
2020-08-25 13:31:11 +02:00
Eelco Dolstra
33b1679d75
Allow primops to have Markdown documentation
2020-08-24 13:16:02 +02:00
Eelco Dolstra
25ecfffdc3
Remove PrimOp constructor
2020-08-20 12:34:04 +02:00
Eelco Dolstra
c8fa39324a
Generate the nix.conf docs from the source code
...
This means we don't have two (divergent) sets of option descriptions
anymore.
2020-08-19 18:28:04 +02:00
Eelco Dolstra
2ffc058950
Make --no-eval-cache a global setting
2020-08-07 14:13:24 +02:00
John Ericson
9423f64ee2
Parse CA derivations using new output variants
...
We no longer need `ParsedDerivation` because everything libstore needs
to know about is in the `BasicDerivation` proper.
2020-07-22 23:59:25 +00:00
Eelco Dolstra
54712aaf8a
Merge remote-tracking branch 'origin/master' into flakes
2020-07-06 16:40:10 +02:00
Eelco Dolstra
50f13b06fb
EvalCache: Store string contexts
2020-06-29 19:08:37 +02:00
Eelco Dolstra
adf2fbbdc2
Merge remote-tracking branch 'origin/master' into flakes
2020-06-26 08:46:46 +02:00
Ben Burdette
e6f93b94fc
Merge branch 'master' into caveman-LOCs
2020-06-18 13:07:53 -06:00
Eelco Dolstra
2a61bbf77f
Some backports from the flakes branch
2020-06-18 14:03:00 +02:00
Matthew Bauer
f767bedfac
Replace struct StorePath with class StorePath
...
also a similar case with struct Goal
2020-06-17 13:26:37 -04:00
Ben Burdette
6a420d672c
print LOC for stdin, string args
2020-05-20 22:18:26 -06:00
Eelco Dolstra
b4e23dcd9e
nix search: Search legacyPackages recursively
2020-04-27 16:29:26 +02:00
Eelco Dolstra
aaa109565e
Use a more space/time-efficient representation for the eval cache
2020-04-17 23:04:21 +02:00
Eelco Dolstra
0a10854f85
Misc changes from the flakes branch
2020-03-24 14:34:47 +01:00
Eelco Dolstra
c34a20e1f6
EvalState::allocAttr(): Add convenience method
...
(cherry picked from commit c02da99757
)
2020-03-24 13:26:37 +01:00
Eelco Dolstra
1537e270fb
Merge remote-tracking branch 'origin/master' into flakes
2020-03-20 13:15:11 +01:00
John Ericson
68fe0d9809
Add missing #include <regex>
2020-03-13 21:24:35 -04:00
Eelco Dolstra
35f6651735
Merge remote-tracking branch 'origin/master' into flakes
2020-03-11 17:03:38 +01:00
Eelco Dolstra
e02481ded2
parseExprFromString(): Use std::string_view
2020-03-11 16:56:29 +01:00
Eelco Dolstra
73b6d87e17
Merge remote-tracking branch 'origin/master' into flakes
2020-03-04 13:58:42 +01:00
Eelco Dolstra
401b5bc541
builtins.cache: Cache regular expressions
...
The evaluator was spending about 1% of its time compiling a small
number of regexes over and over again.
2020-03-04 11:44:33 +01:00
Eelco Dolstra
9f4d8c6170
Pluggable fetchers
...
Flakes are now fetched using an extensible mechanism. Also lots of
other flake cleanups.
2020-01-21 22:56:04 +01:00