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

20275 commits

Author SHA1 Message Date
John Ericson
32d19040e7
Merge pull request #13268 from NixOS/derivation-builder-cleanup
Remove `buildUser` from `DerivationBuilder`
2025-05-26 12:10:57 -04:00
Eelco Dolstra
93ae95be83 Remove duplicate comments on DerivationBuilderImpl overriden methods
Having the exact same doc comments isn't very useful/maintainable.
2025-05-26 16:05:54 +02:00
Eelco Dolstra
69914e4b3c Remove buildUser from DerivationBuilder
The use of a `buildUser` is an implementation detail of some types of
sandboxes that shouldn't exposed.
2025-05-26 16:05:35 +02:00
Jörg Thalheim
ed3e2a71ea
Merge pull request #12994 from fricklerhandwerk/reword-derivation
glossary: re-introduce "derivation"
2025-05-26 14:58:52 +02:00
Eelco Dolstra
170f6021cf
Merge pull request #13265 from Mic92/fix-shallow-clone-subset
Improve errors when we are trying to access a git repository with partial history (+ fix fetchGit on these repos)
2025-05-26 14:53:08 +02:00
Jörg Thalheim
5419d82547 tests/fetchGit: work around something that looks a bash parsing quirk.
Before we got something like this but only inside the VM test:

 vm-test-run-functional-tests-on-nixos_user> machine # fetchGit.sh: line 286: unexpected EOF while looking for matching `)'

We now try to do not too much in a single line, so that the bash parser does not get confused.
This also seems more readable and better quoted.
2025-05-26 12:44:31 +02:00
Jörg Thalheim
b1ccfaa080 git/revCount: improve error message when we have incomplete git history 2025-05-26 12:44:31 +02:00
Jörg Thalheim
0479db934c fetchGit: don't compute revCount on shallow repository
This can never work and leads to a crash bug.
2025-05-26 09:56:44 +02:00
Jörg Thalheim
247f166f87
Merge pull request #13245 from stefanboca/sb/push-yoorqzwsxmzn
nix-profile{,-daemon}.fish: check for profile in XDG_DATA_HOME
2025-05-26 00:14:40 +02:00
Jörg Thalheim
d929eed168
Merge pull request #13262 from xokdvium/typos
Fix various typos in source code
2025-05-25 23:42:21 +02:00
Sergei Zimmerman
114de63d88
Fix various typos in source code
This only touches code comments, class names, documentation,
enumeration names and tests.
2025-05-25 20:14:11 +00:00
Jörg Thalheim
4777734974
Merge pull request #13261 from xokdvium/eval-profiler-derivations
libexpr: Include derivation names in the call stack profile
2025-05-25 21:15:54 +02:00
Sergei Zimmerman
9e97ecabb6
libexpr: Include derivation names in the call stack profile
This makes the profiler much more useful by actually distiguishing
different derivations being evaluated. This does make the implementation
a bit more convoluted, but I think it's worth it.
2025-05-25 15:53:01 +00:00
Sergei Zimmerman
a76c76a9d5
libexpr: Make getAttr a member function of EvalState 2025-05-25 15:52:58 +00:00
Sergei Zimmerman
128750225d
libexpr: Pass mutable EvalState to EvalProfiler
Sometimes the profiler might want to do evaluation (e.g. for getting
derivation names). This is not ideal, but is really necessary
to make the profiler stack traces useful for end users.
2025-05-25 15:52:56 +00:00
Jörg Thalheim
543cee1c92
Merge pull request #13244 from stefanboca/sb/push-lmnqpuztqxmz
nix-profile{,-daemon}.fish: fix do not source twice
2025-05-25 17:48:25 +02:00
Stefan Boca
751f50f4ad nix-profile{,-daemon}.fish: check for profile in XDG_DATA_HOME
...and also NIX_STATE_HOME in nix-profile.fish. This is directly
translated from the bash scripts and makes the fish scripts equivalent
in functionality to the bash scripts.

Note that nix-profile.fish checks for NIX_STATE_HOME and
nix-profile-daemon.fish does not, so the two scripts are no longer
identical.
2025-05-25 17:15:32 +02:00
Jörg Thalheim
087f268615
Merge pull request #13256 from NixOS/fix-substitution-crash
Fix nlohmann error in fromStructuredAttrs()
2025-05-25 07:54:28 +02:00
tomberek
68f8e1c32e
Merge pull request #13257 from NixOS/robust-s3-test
Make the S3 test more robust
2025-05-24 14:10:54 -04:00
Eelco Dolstra
ca9696748a Make the S3 test more robust
Waiting for the minio unit is apparently not reliable enough, so let's
also wait for the port.
2025-05-24 01:30:51 +02:00
Eelco Dolstra
c66eb9cef7 Add test 2025-05-24 00:40:06 +02:00
Eelco Dolstra
d877b0c0cc fromStructuredAttrs(): Don't crash if exportReferencesGraph is a string
Fixes

  error: [json.exception.type_error.302] type must be array, but is string

and other crashes.

Fixes #13254.
2025-05-24 00:17:03 +02:00
Eelco Dolstra
fa6e10ea6a Don't use 'callback' object that we may have moved out of 2025-05-24 00:14:03 +02:00
Jörg Thalheim
81884c36a3
Merge pull request #13248 from xokdvium/logger-exceptions
libmain: Catch logger exceptions in `handleExceptions`
2025-05-23 15:26:13 +02:00
Jörg Thalheim
2d20cd8085
Merge pull request #13253 from xokdvium/pkgconf-c
export/meson: Don't require `-std=c++2a` for -c libraries in `.pc` files
2025-05-23 15:17:32 +02:00
Sergei Zimmerman
d8da8f0cd6
export/meson: Don't require -std=c++2a for -c libraries in .pc files 2025-05-23 12:06:59 +00:00
Jörg Thalheim
4cc312a6e1
Merge pull request #13251 from Mic92/json-log-path
Add `json-log-path` setting (revisted)
2025-05-23 11:25:40 +02:00
Jörg Thalheim
7cef4559fe util/json-log-path: document unix sockets and concurrency issues 2025-05-23 10:45:12 +02:00
Eelco Dolstra
7240fb198f Add json-log-path setting
This setting specifies a path (which can be a regular file or Unix
domain socket) that receives a copy of all Nix log messages (in JSON
format).
2025-05-23 10:45:12 +02:00
Eelco Dolstra
0087188d47 Add convenience function for connecting to a Unix domain socket 2025-05-23 10:45:12 +02:00
Jörg Thalheim
906cc88f4e
Merge pull request #13220 from xokdvium/flamegraph
Stack sampling flamegraph profiler
2025-05-23 10:42:49 +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
Sergei Zimmerman
90d1ff4805
libmain: Catch logger exceptions in handleExceptions
Avoid std::terminate in case logging code also
throws.
2025-05-22 23:08:59 +00: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
Sergei Zimmerman
2190bf2006
doc: Add eval-profiler documentation and release note 2025-05-21 22:16:31 +00: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
Sergei Zimmerman
33141cd133
tests/functional: Add tests for flamegraph profiler
The tests are mostly based on existing `function-trace.sh`
with some tests for corner cases.
2025-05-21 20:15:22 +00:00
Sergei Zimmerman
5e74c0e4d6
libexpr: Add SampleStack stack-sampling profiler
This patch adds support for a native stack sampling
profiler to the evaluator, which saves a collapsed stack
profile information to a configurable location.

Introduced options (in `EvalSettings`):

- `eval-profile-file` - path to the collected profile file.
- `eval-profiler-frequency` - sampling frequency.
- `eval-profiler` - enumeration option for enabling the profiler.

  Currently only `flamegraph` is supported, but having this an
  enumeration rather than a boolean switch leaves the door open
  for other profiler variants (e.g. tracy).

Profile includes the following information on best-effort basis (e.g. some lambdas might
have an undefined name). Callstack information contains:

- Call site location (where the function gets called).
- Primop/lambda name of the function being called.
- Functors/partial applications don't have a name attached to them unlike special-cased primops and lambads.

For cases where callsite location isn't available we have to resort to providing
the location where the lambda itself is defined. This removes some of the confusing
`«none»:0` locations in the profile from previous attempts.

Example usage with piping directly into zstd for compression:

```
nix eval --no-eval-cache nixpkgs#nixosTests.gnome \
  --eval-profiler flamegraph \
  --eval-profile-file >(zstd -of nix.profile.zstd)
```

Co-authored-by: Jörg Thalheim <joerg@thalheim.io>
2025-05-21 20:15:19 +00:00
Stefan Boca
b9ed3ae36e
nix-profile{,-daemon}.fish: fix do not source twice
Commit b36637c8f7 set
`__ETC_PROFILE_NIX_SOURCED` globally, but this is not enough to prevent
the script from being run again by child shells, because the
variable was not exported and thus not inherited by any child process.
Exporting the variable also agrees with the bash scripts.

Notably, the old behavior broke `nix develop -c fish` in some cases,
because the profile bin directory got prepended to the path, causing
binaries from the profile to override binareis from the devshell.
2025-05-21 11:29:47 -07: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
Stefan Boca
f627b8c721
nix-profile{,-daemon}.fish: format with fish_indent 2025-05-20 22:11:39 -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