1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00
Commit graph

20265 commits

Author SHA1 Message Date
Sergei Zimmerman
8ee513379a
Use StringMap instead of std::map<std::string, std::string> throughout the codebase 2025-05-19 20:33:28 +00:00
Sergei Zimmerman
a4bfd559f1
libexpr: Use attrs.alreadySorted() in primop_functionArgs
Formals are already sorted as it's an invariant of `Formals`.
2025-05-19 19:53:20 +00:00
Gwenn Le Bihan
51151c2c28 docs: add another equivalence for the implication operator
the second equivalence, using a if-else expression, aligns much closer to how most humans think about implication, adding it might help some people :)
2025-05-19 17:37:29 +02:00
Gwenn Le Bihan
5c512a4ee1
docs: clarify attrset __functor 2025-05-19 16:58:16 +02:00
Eelco Dolstra
8c10104e9e
Merge pull request #13228 from Mic92/json-utils
libutil-tests/json-utils: fix -Werror=sign-compare error
2025-05-19 16:15:09 +02:00
Robert Hensing
f18af849fe
Merge pull request #13170 from MattSturgeon/fix/call-flake/rel-path
Use correct parent `outPath` for relative path inputs
2025-05-19 14:13:54 +02:00
Jörg Thalheim
1290b7e53d libutil-tests/json-utils: fix -Werror=sign-compare error
I am on a newer different nixpkgs branch, so I am getting this error
2025-05-19 09:26:24 +02:00
Jörg Thalheim
e7078d4de1
Merge pull request #13142 from xokdvium/gc-root-boost-regex
libstore: Use `boost::regex` for GC root discovery
2025-05-18 21:44:41 +02:00
Jörg Thalheim
638b7ec6c5
Merge pull request #13219 from xokdvium/eval-profiler
libexpr: Add `EvalProfiler` and use it for `FunctionCallTrace`
2025-05-18 21:35:43 +02:00
Jörg Thalheim
f2671886f5
Merge pull request #13223 from NixOS/remove-global-fetcher-cache
Remove global fetcher cache
2025-05-18 15:58:53 +02:00
Sergei Zimmerman
fa6f69f9c5
libexpr: Use EvalProfiler for FunctionCallTrace
This wires up the {pre,post}FunctionCallHook machinery
in EvalState::callFunction and migrates FunctionCallTrace
to use the new EvalProfiler mechanisms for tracing.

Note that branches when the hook gets called are marked with [[unlikely]]
as a hint to the compiler that this is not a hot path. For non-tracing
evaluation this should be a 100% predictable branch, so the performance
cost is nonexistent.

Some measurements to prove support this point:

```
nix build .#nix-cli
nix build github:nixos/nix/d692729759e4e370361cc5105fbeb0e33137ca9e#nix-cli --out-link before
```

(Before)

```
$ taskset -c 2,3 hyperfine "GC_INITIAL_HEAP_SIZE=16g before/bin/nix eval nixpkgs#gnome --no-eval-cache" --warmup 4
Benchmark 1: GC_INITIAL_HEAP_SIZE=16g before/bin/nix eval nixpkgs#gnome --no-eval-cache
  Time (mean ± σ):      2.517 s ±  0.032 s    [User: 1.464 s, System: 0.476 s]
  Range (min … max):    2.464 s …  2.557 s    10 runs
```

(After)

```
$ taskset -c 2,3 hyperfine "GC_INITIAL_HEAP_SIZE=16g result/bin/nix eval nixpkgs#gnome --no-eval-cache" --warmup 4
Benchmark 1: GC_INITIAL_HEAP_SIZE=16g result/bin/nix eval nixpkgs#gnome --no-eval-cache
  Time (mean ± σ):      2.499 s ±  0.022 s    [User: 1.448 s, System: 0.478 s]
  Range (min … max):    2.472 s …  2.537 s    10 runs
```
2025-05-18 11:55:39 +00:00
Sergei Zimmerman
6b4a86a9e3
libexpr: Add EvalProfiler
This patch adds an EvalProfiler and MultiEvalProfiler that can be used
to insert hooks into the evaluation for the purposes of function tracing
(what function-trace currently does) or for flamegraph/tracy profilers.

See the following commits for how this is supposed to be integrated into
the evaluator and performance considerations.
2025-05-18 11:55:37 +00:00
Matt Sturgeon
2922e3082e
Add release note for non-flake inputs having sourceInfo 2025-05-18 00:45:33 +01:00
Matt Sturgeon
72232bc28a
tests/functional/flakes/non-flake-inputs: Test non-flake inputs having sourceInfo 2025-05-18 00:40:09 +01:00
Robert Hensing
eaee0b4740
tests/function/flakes/relative-paths: Test #13164 2025-05-18 00:40:08 +01:00
Matt Sturgeon
46beb9af76
Use correct parent outPath for relative path inputs
Ensure relative path inputs are relative to the parent node's _actual_
`outPath`, instead of the subtly different `sourceInfo.outPath`.

Additionally, non-flake inputs now also have a `sourceInfo` attribute.

This fixes the relationship between `self.outPath` and
`self.sourceInfo.outPath` in some edge cases.

Fixes #13164
2025-05-18 00:38:17 +01:00
Eelco Dolstra
5f75738fd6 Install 'nix profile add' manpage 2025-05-17 21:18:04 +02:00
Eelco Dolstra
fd407141e1 Make nix profile install an alias of nix profile add 2025-05-17 21:07:24 +02:00
Graham Christensen
b37d1cdd8e Rename nix profile install to nix profile add. 2025-05-17 21:07:24 +02:00
Eelco Dolstra
efcb9e36a9 Remove global fetcher cache
The cache is now part of fetchers::Settings.
2025-05-17 19:54:32 +02:00
Eelco Dolstra
7d89e46f65 Sync: Support moving out of another Sync 2025-05-17 19:38:36 +02:00
Eelco Dolstra
e5e5c819dd
Merge pull request #13221 from roberth/doc-rl-docroot
doc: Render verbatim `@docroot@` on contributing page
2025-05-17 19:18:59 +02:00
Robert Hensing
147a34c573 doc: Render verbatim @docroot@ on contributing page
In rendered form:

```diff
-Add references to the manual using ..
+Add references to the manual using [links like this](@docroot@/example.md)
```
2025-05-17 17:50:49 +02:00
Eelco Dolstra
39f9f5d1b6
Merge pull request #13206 from obsidiansystems/goal-init-dedup
Deduplicate the goal creation functions
2025-05-17 09:07:51 +02:00
Jörg Thalheim
d692729759
Merge pull request #13212 from pbsds/lexical-illusions
docs: remove repeated "allowedReferences" and other lexical illusion
2025-05-16 16:59:23 +02:00
Jörg Thalheim
041d2374dd
Merge pull request #13213 from pbsds/deriving-path-encoding-anchor
docs: fix duplicate anchor
2025-05-16 11:28:31 +02:00
Peder Bergebakken Sundt
4c50cf798e docs: fix duplicate anchor
`#deriving-path-encoding` is defined in two places, I _think_ this is the correct one to change.
2025-05-16 10:27:29 +02:00
Peder Bergebakken Sundt
ea5302c4a2 docs: remove lexical illusions detected with write-good
I made this this non-markdown aware tool somewhat behave with some cursed fd+pandoc invocations
2025-05-16 09:52:19 +02:00
Peder Bergebakken Sundt
cb16cd707c docs: remove repeated "allowedReferences"
This is what write-good lints as a "lexical illusion"
2025-05-16 09:20:55 +02:00
John Ericson
b21fc05047
Merge pull request #13211 from xokdvium/pos-table
libexpr: Actually cache line information in PosTable
2025-05-16 00:37:57 -04:00
Sergei Zimmerman
5ea81f5b8f
libexpr: Actually cache line information in PosTable
Previous code had a sneaky bug due to which no caching
actually happened:

```cpp
auto linesForInput = (*lines)[origin->offset];
```

That should have been:
```cpp
auto & linesForInput = (*lines)[origin->offset];
```

See [1].

Now that it also makes sense to make the cache bound in side
in order not to memoize all the sources without freeing any memory.
The default cache size has been chosen somewhat arbitrarily to be ~64k
origins. For reference, 25.05 nixpkgs has ~50k .nix files.

Simple benchmark:

```nix
let
  pkgs = import <nixpkgs> { };
in
builtins.foldl' (acc: el: acc + el.line) 0 (
  builtins.genList (x: builtins.unsafeGetAttrPos "gcc" pkgs) 10000
)
```

(After)

```
$ hyperfine "result/bin/nix eval -f ./test.nix"
Benchmark 1: result/bin/nix eval -f ./test.nix
  Time (mean ± σ):     292.7 ms ±   3.9 ms    [User: 131.0 ms, System: 120.5 ms]
  Range (min … max):   288.1 ms … 300.5 ms    10 runs
```

(Before)

```
hyperfine "nix eval -f ./test.nix"
Benchmark 1: nix eval -f ./test.nix
  Time (mean ± σ):     666.7 ms ±   6.4 ms    [User: 428.3 ms, System: 191.2 ms]
  Range (min … max):   659.7 ms … 681.3 ms    10 runs
```

If the origin happens to be a `all-packages.nix` or similar in size then the
difference is much more dramatic.

[1]: 22e3f0e987
2025-05-15 23:07:25 +00:00
Sergei Zimmerman
4711720efe
libutil: Add LRUCache::getOrNullptr
For heavier objects it doesn't make sense to return
a std::optional with the copy of the data, when it
can be used by const reference.
2025-05-15 22:28:41 +00:00
John Ericson
dc1a5135ee
Merge pull request #13207 from xokdvium/drop-bear
dev-shell: Drop bear dependency
2025-05-15 17:48:08 -04:00
Sergei Zimmerman
67535263a5
dev-shell: Drop bear dependency
Since the autotools-based build system has been removed
and meson already generates compile database there's no
need to have it in the devshell.
2025-05-15 21:13:13 +00:00
John Ericson
7bd9eef772 Deduplicate the goal creation functions
The weak reference logic is the same in both these cases, and if/when I
get rid `addWantedOutputs`, also in the `DerivationGoal` case.
2025-05-15 16:59:48 -04:00
John Ericson
01207fd101 Remove useDerivation
Try to make `DerivationGoal` care less whether we're working from an
in-memory derivation or not.

It's a clean-up in its own right, but it will also help with other
cleanups under the umbrella of #12628.
2025-05-15 13:40:26 -04:00
John Ericson
c1085ce849 Get rid of virtual Goal::init()
Now, each class provides the initial coroutine by value. This avoids
some sketchy virtual function stuff, and will also be further put to
good use in the next commit.
2025-05-15 13:40:26 -04:00
Jörg Thalheim
0d3750e902
Merge pull request #13202 from NixOS/fix-nix-copy-closure-test
Fix nix-copy-closure VM test
2025-05-15 17:50:12 +02:00
Eelco Dolstra
d626348f42 Fix nix-copy-closure VM test
https://hydra.nixos.org/build/297112538
2025-05-15 12:55:08 +02:00
Jörg Thalheim
ea09198f93
Merge pull request #13197 from NixOS/bump-nixpkgs
Update Nixpkgs to fix static builds
2025-05-15 12:20:06 +02:00
Eelco Dolstra
0b46025f7a
Merge pull request #13196 from Mic92/store-config-base
rename StoreDirConfigItself to StoreDirConfigBase
2025-05-15 12:03:11 +02:00
Jörg Thalheim
2dacdd110c
Merge pull request #13195 from NixOS/remove-nix_2_18
Remove otherNixes.nix_2_18
2025-05-15 11:43:12 +02:00
Eelco Dolstra
3ba49d7ec2 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/f02fddb8acef29a8b32f10a335d44828d7825b78?narHash=sha256-IgBWhX7A2oJmZFIrpRuMnw5RAufVnfvOgHWgIdds%2Bhc%3D' (2025-05-01)
  → 'github:NixOS/nixpkgs/adaa24fbf46737f3f1b5497bf64bae750f82942e?narHash=sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY%3D' (2025-05-13)
2025-05-15 11:31:34 +02:00
Jörg Thalheim
2dd2142754 rename StoreDirConfigItself to StoreDirConfigBase
context: https://github.com/NixOS/nix/pull/13154#discussion_r2081904653
2025-05-15 11:24:42 +02:00
Eelco Dolstra
3285b68044
Merge pull request #13176 from obsidiansystems/revert-incomplete-closure-feature
Revert #77
2025-05-15 11:13:31 +02:00
Eelco Dolstra
bc85e20fb9 Remove otherNixes.nix_2_18
Nixpkgs no longer has Nix 2.18, so this fails to evaluate.
2025-05-15 11:10:21 +02:00
John Ericson
c3e7e88889
Merge pull request #13194 from NixOS/bump-2.30.0
Bump 2.30.0
2025-05-14 20:40:24 -04:00
John Ericson
99cb85cd37 Revert "If a substitute closure is incomplete, build dependencies, then retry the substituter"
As summarized in
https://github.com/NixOS/nix/issues/77#issuecomment-2843228280 the
motivation is that the complicated retry logic this introduced was
making the cleanup task #12628 harder to accomplish. It was not easy to
ascertain just what policy / semantics the extra control-flow was
implementing, in order to figure out a different way to implementing it
either.

After talking to Eelco about it, he decided we could just....get rid of
the feature entirely! It's a bit scary removing a decade+ old feature,
but I think he is right. See the release notes for more explanation.

This reverts commit 299141ecbd.

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2025-05-14 20:16:40 -04:00
John Ericson
95e1f463c8 .mergify.yml: Add backport 2.29-maintenance entry 2025-05-14 19:59:22 -04:00
John Ericson
6591a4119c Bump version 2025-05-14 19:59:22 -04:00