Robert Hensing
0c75581d8b
Move call-flake.nix to nix-flake
...
As suggested by Ericson2314 in review
https://github.com/NixOS/nix/pull/12759#issuecomment-2755352343
2025-03-27 14:29:07 +00:00
Robert Hensing
3c4c0953e0
nix-expr: Add primops to EvalSettings
2025-03-26 09:32:43 +00:00
Sergei Zimmerman
adbd08399c
{libexpr,libcmd}: Make debugger significantly faster
...
The underlying issue is that debugger code path was
calling PosTable::operator[] in each eval method.
This has become incredibly expensive since 5d9fdab3de
.
While we are it it, I've reworked the code to
not use std::shared_ptr where it really isn't necessary.
As I've documented in previous commits, this is actually
more a workaround for recursive header dependencies now
and is only necessary in `error.hh` code.
Some ad-hoc benchmarking:
After this commit:
```
Benchmark 1: nix eval nixpkgs#hello --impure --ignore-try --no-eval-cache --debugger
Time (mean ± σ): 784.2 ms ± 7.1 ms [User: 561.4 ms, System: 147.7 ms]
Range (min … max): 773.5 ms … 792.6 ms 10 runs
```
On master 3604c7c51:
```
Benchmark 1: nix eval nixpkgs#hello --impure --ignore-try --no-eval-cache --debugger
Time (mean ± σ): 22.914 s ± 0.178 s [User: 18.524 s, System: 4.151 s]
Range (min … max): 22.738 s … 23.290 s 10 runs
```
2025-03-13 16:24:30 +00:00
Brian McKenna
c82ef825d4
coerceToSingleDerivedPathUnchecked: pass through experimental features
...
This fixes a few of the property tests, now that the property tests
are actually generating arbitrary data - some of that data now
requiring experimental features to function properly.
2025-03-08 19:14:58 +11:00
John Ericson
de22f58dfc
Introduce EvalStore::storePath
...
This abstracts over a common case. Good for brevity, and enabling
further experiments.
2025-02-19 21:24:26 -05:00
Eelco Dolstra
99e78c37f7
Use UnionSourceAccessor to mount the chroot store on top of the real store directory
2025-02-19 12:54:09 +01:00
Eelco Dolstra
774b924398
Add a storeFS accessor for paths resulting from IFD
...
Hopefully fixes #11503 .
2025-02-19 12:47:28 +01:00
Robert Hensing
7465fbe926
refactor: Extract EvalState::realiseString
2025-01-27 12:32:46 +01:00
Eelco Dolstra
08361f031d
EvalState::realiseContext(): Allow access to the entire closure
...
Fixes #11030 .
2024-12-16 16:16:36 +01:00
Eelco Dolstra
ad7ad017ea
EvalState::callPathFilter(): Remove unnecessary pathArg argument
2024-11-20 16:35:47 +01:00
Robert Hensing
32becc87fe
Merge pull request #11914 from roberth/evalstate-get-builtins
...
EvalState::getBuiltins
2024-11-19 19:33:37 +01:00
Robert Hensing
8a36d2d8a7
Add EvalState::getBuiltins
2024-11-19 18:23:05 +01:00
Eelco Dolstra
af07f33d37
resolveLookupPathPath(): Return a SourcePath instead of a string
...
Cherry-picked from lazy-trees.
2024-11-19 18:03:31 +01:00
Robert Hensing
a58e38dab7
Make EvalState::getBuiltin safe for missing attr
2024-11-19 17:30:58 +01:00
Robert Hensing
61d075840f
Merge pull request #11866 from DeterminateSystems/callFunction-span
...
callFunction: Use std::span
2024-11-18 18:37:12 +01:00
Eelco Dolstra
a2e4a4c238
callFunction: Use std::span
...
This is a bit safer than having a separate nrArgs argument.
2024-11-12 19:26:39 +01:00
Eelco Dolstra
02f0294be0
Fix most DoxyGen warnings
...
Helps with #11841 .
2024-11-12 15:34:24 +01:00
Eelco Dolstra
67a42e6240
Merge remote-tracking branch 'origin/master' into flake-substitution
2024-11-11 13:57:24 +01:00
Robert Hensing
a3613f2a3c
autoCallFunction: accept const Bindings &
...
It does not need to mutate the attrs.
`const` is shallow.
Avoids a const_cast in the hercules-ci-cnix-expr bindings.
2024-11-10 20:52:05 +01:00
Eelco Dolstra
4dceca51de
Don't allow __final in fetchTree
...
It's now only allowed in fetchFinalTree, which is not exposed to users
but only to call-flake.nix.
2024-11-08 19:27:54 +01:00
Eelco Dolstra
b9f78abb7f
Alias traceable_allocator to std::allocator when building without GC
...
This allows us to get rid of a bunch of #ifdefs.
2024-09-19 21:04:01 +02:00
Robert Hensing
72a4d1f52d
Add :doc support for __functor
2024-08-15 13:04:34 +02:00
Robert Hensing
6068e32aa7
refactor: Extract EvalState::addCallDepth
2024-08-15 13:04:34 +02:00
Eelco Dolstra
d08bb025e1
Merge pull request #11043 from hercules-ci/assert-eq
...
`assert`: Report why values aren't equal
2024-07-22 17:34:28 +02:00
Robert Hensing
6c9d62dceb
Doc comments: use std::unordered_map
...
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2024-07-16 15:19:39 +02:00
Eelco Dolstra
9c6678da0e
Merge pull request #11092 from DeterminateSystems/hash-SourcePath
...
Use std::unordered_map for the EvalState caches
2024-07-16 11:06:43 +02:00
Robert Hensing
6a125e65d0
Revert "Doc comments: use std::unordered_map"
...
hash<SourcePath> isn't implemented yet, and I can't cherry-pick
a bug-free commit yet.
This reverts commit 95529f31e3bbda99111c5ce98a33484dc6e7a462.
2024-07-15 19:56:40 +02:00
Robert Hensing
21817473e8
Doc comments: use std::unordered_map
...
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2024-07-15 19:56:40 +02:00
Robert Hensing
d4f576b0b2
nix repl: Render docs for attributes
2024-07-15 19:56:40 +02:00
Eelco Dolstra
cdc23b67a6
Provide std::hash<SourcePath>
2024-07-12 17:54:27 +02:00
John Ericson
337a5a23b7
Merge pull request #11089 from NixOS/warnings-includes
...
Fix warnings and optimize includes
2024-07-12 10:29:26 -04:00
Robert Hensing
8df041cbc6
Solve unused header warnings reported by clangd
2024-07-12 15:37:54 +02:00
John Ericson
3fc77f281e
No global settings in libnixfetchers
and libnixflake
...
Progress on #5638
There are still a global fetcher and eval settings, but they are pushed
down into `libnixcmd`, which is a lot less bad a place for this sort of
thing.
Continuing process pioneered in
52bfccf8d8
.
2024-07-12 08:50:28 -04:00
Robert Hensing
cfe3ee3de8
nix-shell
: look up shell.nix
when argument is a directory (#11057 )
...
* Refactor: rename runEnv -> isNixShell
* Refactor: rename left -> remainingArgs
* nix-build.cc: Refactor: extract baseDir variable
* nix-build.cc: Refactor: extract sourcePath, resolvedPath variables
* nix-shell: Look for shell.nix when directory is specified
* Add legacy setting: nix-shell-always-looks-for-shell-nix
* rl-next: Add note about shell.nix lookups
* tests/functional/shell.nix: Implement runHook for dummy stdenv
2024-07-08 14:36:36 +02:00
Robert Hensing
d63bd8295e
assert: Report why values aren't equal
2024-07-05 16:43:48 +02:00
John Ericson
52bfccf8d8
No global eval settings in libnixexpr
...
Progress on #5638
There is still a global eval settings, but it pushed down into
`libnixcmd`, which is a lot less bad a place for this sort of thing.
2024-06-24 12:15:16 -04:00
Robert Hensing
6f64154eea
Merge pull request #10884 from tomberek/tomberek.warn_structuredAttrs_advanced
...
fix: warn and document when advanced attributes will have no impact d…
2024-06-24 07:56:26 +02:00
John Ericson
5b53d8fec3
Factor out GC initialization code
...
This is not really part of the evaluator: it is just an integration
between Boehm GC and Boost coroutines usable for any purpose. The
evaluator (merely) optionally uses it.
2024-06-12 16:00:03 -04:00
Tom Bereknyei
4809e59b7e
fix: warn and document when advanced attributes will have no impact due to __structuredAttrs
2024-06-10 09:31:21 -04:00
Eelco Dolstra
7d295c594e
Make EvalState::srcToStore thread-safe
2024-06-04 16:56:06 +02:00
Robert Hensing
c07500e14d
refactor: Extract EvalState::{runDebugRepl,canDebug}
2024-06-03 16:24:21 +02:00
Eelco Dolstra
ba5929c7be
Merge InputAccessor into SourceAccessor
...
After the removal of the InputAccessor::fetchToStore() method, the
only remaining functionality in InputAccessor was `fingerprint` and
`getLastModified()`, and there is no reason to keep those in a
separate class.
2024-05-03 12:14:01 +02:00
Robert Hensing
f34b52b521
libexpr: Add missing GC root for baseEnv
...
This missing GC root wasn't much of a problem before, because the
heap would end up with a reference to the `baseEnv` pretty soon,
but when unit testing, the construction of `EvalState` doesn't
necessarily happen well before GC runs for the first time.
Found while unit testing the Rust bindings that currently reside
at https://github.com/nixops4/nixops4/tree/main/rust
2024-05-01 22:36:39 +02:00
Guillaume Maudoux
a60a1f09b2
Reuse eval caches and related values when possible
2024-04-22 20:32:41 +02:00
Roland Coeurjoly
62ce139e3f
No need to undef now that there is no collision
2024-04-13 23:34:01 +02:00
Roland Coeurjoly
40a6a9fdb8
Rename SearchPath to LookupPath and searchPath to lookupPath
2024-04-13 17:35:15 +02:00
John Ericson
8433027e35
Build a minimized Nix with MinGW
...
At this point many features are stripped out, but this works:
- Can run libnix{util,store,expr} unit tests
- Can run some Nix commands
Co-Authored-By volth <volth@volth.com>
Co-Authored-By Brian McKenna <brian@brianmckenna.org>
2024-04-17 12:26:10 -04:00
Eelco Dolstra
6a3ecdaa39
Merge remote-tracking branch 'origin/master' into finish-value
2024-04-17 16:02:44 +02:00
Robert Hensing
02c41aba5b
libexpr-c: Add nix_string_realise
2024-04-05 16:08:18 +02:00
Robert Hensing
12ec3154b8
Merge pull request #8699 from tweag/nix-c-bindings
...
(Towards) stable C bindings for libutil, libexpr
2024-04-04 17:50:52 +02:00