1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00
Commit graph

20087 commits

Author SHA1 Message Date
Eelco Dolstra
0087188d47 Add convenience function for connecting to a Unix domain socket 2025-05-23 10:45:12 +02:00
Jörg Thalheim
5b4806ab3c
Merge pull request #13249 from NixOS/more-robust-json-logger
Make the JSON logger more robust
2025-05-23 10:25:16 +02:00
Jörg Thalheim
76358748da
Merge pull request #13143 from jfly/issue-8034-nix-fmt
Expose flake directory to `nix fmt` as `PRJ_ROOT` env var
2025-05-23 10:24:26 +02:00
Eelco Dolstra
9f680874c5 Make the JSON logger more robust
We now ignore connection / write errors.
2025-05-23 03:27:57 +02:00
Jeremy Fleischman
17eb2e8400 Expose flake directory to nix fmt as PRJ_ROOT env var
This was discussed in https://github.com/NixOS/nix/issues/8034. I
personally like `PRJ_ROOT`, which hopefully avoids some ambiguity
around with subflakes.

I only implemented this for `nix fmt` because it doesn't let you point
at a flake not on your filesystem.

macOS compilation fixes
2025-05-22 19:18:53 +02:00
Jörg Thalheim
b4bea57667
Merge pull request #13241 from fzakaria/lix-2100
cherry-pick https://gerrit.lix.systems/c/lix/+/2100
2025-05-22 18:56:40 +02:00
John Ericson
76a4d4c291
Merge pull request #13186 from obsidiansystems/dyn-drv-without-new-goal-type
Restore dynamic derivations!
2025-05-21 18:11:32 -04:00
John Ericson
57348b677b Restore dynamic derivations!
This method does *not* create a new type of goal. We instead just make
`DerivationGoal` more sophisticated, which is much easier to do now that
`DerivationBuildingGoal` has been split from it (and so many fields are
gone, or or local variables instead).

This avoids the need for a secondarily trampoline goal that interacted
poorly with `addWantedOutputs`. That, I hope, will mean the bugs from
before do not reappear.

There may in fact be a reason to introduce such a trampoline in the
future, but it would only happen in conjunction with getting rid of
`addWantedOutputs`.

Restores the functionality (and tests) that was reverted in
f4f28cdd0e.
2025-05-21 17:31:41 -04:00
John Ericson
bf5d544d3b
Merge pull request #13181 from obsidiansystems/derivation-building-goal
Split `DerivationGoal` in two
2025-05-21 16:44:16 -04:00
Farid Zakaria
6c85a90b87 Change to atomic<uint32_t> 2025-05-21 10:07:04 -07:00
Farid Zakaria
8fd15ac228 Add canon for path 2025-05-21 10:05:23 -07:00
Farid Zakaria
9e26549c2b Consolidate tempName and makeTempPath 2025-05-21 09:01:49 -07:00
Farid Zakaria
6aed9d877c cherry-pick https://gerrit.lix.systems/c/lix/+/2100
Cherry-pick https://gerrit.lix.systems/c/lix/+/2100

This change fixes a potential concurrency failure when accessing random
which is not thread safe.

Co-authored-by: Lily Ballard <lily@ballards.net>
2025-05-21 08:49:09 -07:00
Eelco Dolstra
e22142e11a
Merge pull request #13224 from NixOS/nix-profile-add
Rename `nix profile install` to `nix profile add`
2025-05-20 20:15:31 +02:00
Eelco Dolstra
6d59fa03fd Add release note 2025-05-20 18:24:13 +02:00
John Ericson
3b617e471b Split DerivationGoal in two
This separation of concerns is generally good, but in particular sets up
for removing `addWantedOutputs` next.
2025-05-20 11:54:53 -04:00
John Ericson
d1295448e0 Copy files before split
Same technique as 6c2a7fdc49.
2025-05-20 11:54:52 -04:00
John Ericson
a6c5d56af7
Merge pull request #13177 from obsidiansystems/less-useDerivation
Remove `useDerivation`
2025-05-20 11:39:48 -04:00
Eelco Dolstra
803c0086f3
Update src/nix/profile-add.md
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
2025-05-20 15:39:40 +02:00
Jörg Thalheim
fad975b58f
Merge pull request #13231 from gwennlbh/docs-attrset-functor
docs: clarify attrset __functor
2025-05-20 09:03:13 +02:00
Jörg Thalheim
7616d290a0
Merge pull request #13232 from gwennlbh/clarify-implication-operator
docs: add another equivalence for the implication operator
2025-05-20 09:01:29 +02:00
Jörg Thalheim
6867a4688a
Merge pull request #13233 from xokdvium/function-args-opt
libexpr: Use `attrs.alreadySorted()` in primop_functionArgs
2025-05-20 08:29:42 +02:00
John Ericson
fe41bdefd7
Merge pull request #13234 from xokdvium/transparent-comparator-map
Use C++14 N3657 transparent comparator for `StringMap` and `StringPairs` (NFC)
2025-05-19 17:55:23 -04:00
Sergei Zimmerman
49d026083b
Use transparent comparators for StringMap and StringPairs 2025-05-19 20:38:19 +00:00
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