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

20080 commits

Author SHA1 Message Date
Eelco Dolstra
d000f5943a rl-2.27.md: Fix GitHub links
https://discourse.nixos.org/t/nix-2-27-0-released/62003/2?u=edolstra
(cherry picked from commit be5a455a1a)
2025-03-21 19:48:51 +00:00
Eelco Dolstra
624b54a392 Bump version 2025-03-21 19:31:47 +01:00
mergify[bot]
d72fc01ffd
Merge pull request #12713 from NixOS/mergify/bp/2.27-maintenance/pr-12636
port crash-handler from lix to nix (backport #12636)
2025-03-21 15:45:09 +00:00
Jade Lovelace
b1f0f1c5a1 port crash-handler from lix to nix
It was first introduced in 19e0ce2c03

In Nix we only register the crash handler in main instead of initNix,
because library user may want to use their own crash handler.

Sample output:

Mar 12 08:38:06 eve nix[2303762]: Nix crashed. This is a bug. Please report this at https://github.com/NixOS/nix/issues with the following information included:
Mar 12 08:38:06 eve nix[2303762]: Exception: nix::SysError: error: writing to file: Resource temporarily unavailable
Mar 12 08:38:06 eve nix[2303762]: Stack trace:
Mar 12 08:38:06 eve nix[2303762]:  0# 0x000000000076876A in nix
                                   1# 0x00007FDA40E9F20A in /nix/store/2lhklm5aizx30qbw49acnrrzkj9lbmij-gcc-14-20241116-lib/lib/libstdc++.so.6
                                   2# std::unexpected() in /nix/store/2lhklm5aizx30qbw49acnrrzkj9lbmij-gcc-14-20241116-lib/lib/libstdc++.so.6
                                   3# 0x00007FDA40E9F487 in /nix/store/2lhklm5aizx30qbw49acnrrzkj9lbmij-gcc-14-20241116-lib/lib/libstdc++.so.6
                                   4# nix::writeFull(int, std::basic_string_view<char, std::char_traits<char> >, bool) in /home/joerg/git/nix/inst/lib/libnixutil.so
                                   5# nix::writeLine(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) in /home/joerg/git/nix/inst/lib/libnixutil.so
                                   6# nix::JSONLogger::write(nlohmann::json_abi_v3_11_3::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long, unsigned long, double, std::allocator, nlohmann::json_abi_v3_11_3::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> >, void> const&) in /home/joerg/git/nix/inst/lib/libnixutil.so
                                   7# nix::JSONLogger::logEI(nix::ErrorInfo const&) in /home/joerg/git/nix/inst/lib/libnixutil.so
                                   8# nix::Logger::logEI(nix::Verbosity, nix::ErrorInfo) in nix
                                   9# nix::handleExceptions(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::function<void ()>) in /home/joerg/git/nix/inst/lib/libnixmain.so
                                  10# 0x000000000087A563 in nix
                                  11# 0x00007FDA40BD41FE in /nix/store/6q2mknq81cyscjmkv72fpcsvan56qhmg-glibc-2.40-66/lib/libc.so.6
                                  12# __libc_start_main in /nix/store/6q2mknq81cyscjmkv72fpcsvan56qhmg-glibc-2.40-66/lib/libc.so.6
                                  13# 0x00000000006F4DF5 in nix

Co-authored-by: eldritch horrors <pennae@lix.systems>
(cherry picked from commit 163f94412a)
2025-03-21 15:31:03 +00:00
Eelco Dolstra
bc3a847784 BuildResult: Serialize builtOutputs 2025-03-21 16:01:00 +01:00
mergify[bot]
616109a040
Merge pull request #12711 from NixOS/mergify/bp/2.27-maintenance/pr-12701
stack overflow is EvalBaseError (backport #12701)
2025-03-21 14:37:25 +00:00
Shahar "Dawn" Or
3f56dd9927 stack overflow is EvalBaseError
(cherry picked from commit 23c7a45a05)
2025-03-21 14:13:40 +00:00
Eelco Dolstra
c32441f207 Remove redundant quotes 2025-03-20 20:20:02 +01:00
mergify[bot]
54bb3f54e8
Merge pull request #12696 from NixOS/mergify/bp/2.27-maintenance/pr-12682
libfetchers: fix double quote in path printed in logger (backport #12682)
2025-03-19 22:48:41 +00:00
Jörg Thalheim
0ec28acef9 libfetchers: fix double quote in path printed in logger
(cherry picked from commit 314e9fbeda)
2025-03-19 22:25:06 +00:00
mergify[bot]
b5dc44c586
Merge pull request #12691 from NixOS/mergify/bp/2.27-maintenance/pr-12687
libutil/file-descriptor: handle EAGAIN in read/write operations (backport #12687)
2025-03-19 22:08:46 +00:00
Jörg Thalheim
32ab3ef598 libutil/file-descriptor: handle EAGAIN in read/write operations
We now see exception beeing thrown when remote building in master
because of writing to a non-blocking file descriptor from our json logger.

> #0  0x00007f2ea97aea9c in __pthread_kill_implementation () from /nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36/lib/libc.so.6
> #1  0x00007f2ea975c576 in raise () from /nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36/lib/libc.so.6
> #2  0x00007f2ea9744935 in abort () from /nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36/lib/libc.so.6
> #3  0x00007f2ea99e8c2b in __gnu_cxx::__verbose_terminate_handler() [clone .cold] () from /nix/store/ybjcla5bhj8g1y84998pn4a2drfxybkv-gcc-13.3.0-lib/lib/libstdc++.so.6
> #4  0x00007f2ea99f820a in __cxxabiv1::__terminate(void (*)()) () from /nix/store/ybjcla5bhj8g1y84998pn4a2drfxybkv-gcc-13.3.0-lib/lib/libstdc++.so.6
> #5  0x00007f2ea99f8275 in std::terminate() () from /nix/store/ybjcla5bhj8g1y84998pn4a2drfxybkv-gcc-13.3.0-lib/lib/libstdc++.so.6
> #6  0x00007f2ea99f84c7 in __cxa_throw () from /nix/store/ybjcla5bhj8g1y84998pn4a2drfxybkv-gcc-13.3.0-lib/lib/libstdc++.so.6
> #7  0x00007f2eaa5035c2 in nix::writeFull (fd=2, s=..., allowInterrupts=true) at ../unix/file-descriptor.cc:43
> #8  0x00007f2eaa5633c4 in nix::JSONLogger::write (this=this@entry=0x249a7d40, json=...) at /nix/store/4krab2h0hd4wvxxmscxrw21pl77j4i7j-gcc-13.3.0/include/c++/13.3.0/bits/char_traits.h:358
> #9  0x00007f2eaa5658d7 in nix::JSONLogger::logEI (this=<optimized out>, ei=...) at ../logging.cc:242
> #10 0x00007f2ea9c5d048 in nix::Logger::logEI (ei=..., lvl=nix::lvlError, this=0x249a7d40) at /nix/store/a7cq5bqh0ryvnkv4m19ffchnvi8l9qx6-nix-util-2.27.0-dev/include/nix/logging.hh:108
> #11 nix::handleExceptions (programName="nix", fun=...) at ../shared.cc:343
> #12 0x0000000000465b1f in main (argc=<optimized out>, argv=<optimized out>) at /nix/store/4krab2h0hd4wvxxmscxrw21pl77j4i7j-gcc-13.3.0/include/c++/13.3.0/bits/allocator.h:163
> (gdb) frame 10
> #10 0x00007f2ea9c5d048 in nix::Logger::logEI (ei=..., lvl=nix::lvlError, this=0x249a7d40) at /nix/store/a7cq5bqh0ryvnkv4m19ffchnvi8l9qx6-nix-util-2.27.0-dev/include/nix/logging.hh:108
> 108             logEI(ei);

So far only drainFD sets the non-blocking flag on a "readable" file descriptor,
while this is a "writeable" file descriptor.
It's not clear to me yet, why we see logs after that point, but it's
also not that bad to handle EAGAIN in read/write functions after all.

(cherry picked from commit 2790f5f9ae)
2025-03-19 21:46:21 +00:00
mergify[bot]
8705feb7cc
Merge pull request #12686 from NixOS/mergify/bp/2.27-maintenance/pr-12570
Fix macos sandbox issue (backport #12570)
2025-03-19 21:23:43 +00:00
Pierre-Etienne Meunier
aecd2b5d92 Fix macos sandbox issue
Co-authored-by: John Ericson <git@JohnEricson.me>

Co-authored-by: Poliorcetics <poliorcetics@users.noreply.github.com>
(cherry picked from commit 300465c7b8)
2025-03-19 20:21:53 +00:00
Eelco Dolstra
8674792eba Make the JSON logger more robust
We now ignore connection / write errors.
2025-03-14 17:33:48 +01:00
Eelco Dolstra
fd0d824fa5 Don't use DerivedPath::toJSON()
It doesn't work on unrealized paths.
2025-03-14 17:06:23 +01:00
mergify[bot]
bdaa8c55d2
Merge pull request #12655 from NixOS/mergify/bp/2.27-maintenance/pr-12645
Make debugger significantly faster (backport #12645)
2025-03-14 13:54:47 +00:00
Sergei Zimmerman
11919bc471 {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
```

(cherry picked from commit adbd08399c)
2025-03-14 13:22:53 +00:00
Sergei Zimmerman
593e0eebeb libutil: Fix Pos::getSourcePath
Previous implementation didn't actually check if
std::get_if returned a nullptr:

std::optional<SourcePath> getSourcePath() const {
    return *std::get_if<SourcePath>(&origin);
}

(cherry picked from commit 50123f2a56)
2025-03-14 13:22:52 +00:00
Sergei Zimmerman
8c2a792d2b libutil: Document hacks and problems around Pos class
This should provide context for follow-up commits in
the patch series.

(cherry picked from commit bf12aedf2e)
2025-03-14 13:22:52 +00:00
Sergei Zimmerman
b540c2419f {libutil,libexpr}: Move pos-idx,pos-table code to libutil
All of this code doesn't actually depend on anything from
libexpr. Because Pos is so tigtly coupled with Error, it
makes sense to have in the same library.

(cherry picked from commit a53b184e63)
2025-03-14 13:22:52 +00:00
Eelco Dolstra
762114b7c4 Log BuildResult 2025-03-13 19:42:52 +01:00
Eelco Dolstra
c515bc66f1 Provide a structured JSON serialisation of hashes 2025-03-13 18:52:29 +01:00
Eelco Dolstra
2a2af3f72f Logger::result(): Support logging arbitrary JSON objects 2025-03-13 18:39:46 +01:00
Eelco Dolstra
220000dc1a makeJSONLogger(): Support logging to a Unix domain socket 2025-03-13 15:48:52 +01:00
Eelco Dolstra
d9730fc93b Fix fd check 2025-03-13 15:42:17 +01:00
Eelco Dolstra
1efccf34b1 JSONLogger: Acquire a lock to prevent log messages from clobbering each other 2025-03-13 13:58:35 +01:00
Eelco Dolstra
29a9e638c1 Remove "@nix" prefix from json-log-path output 2025-03-13 13:37:38 +01:00
Eelco Dolstra
2972e73946 Turn NIX_LOG_FILE into a setting 2025-03-13 13:15:14 +01:00
Eelco Dolstra
1f702cdb01 Allow separate JSON logging
If the NIX_LOG_FILE environment variable is set, Nix will write JSON
log messages to that file in addition to the regular logger (e.g. the
progress bar).
2025-03-13 12:52:15 +01:00
Eelco Dolstra
8ef94c1114 Add a structured log message for FOD hash mismatches 2025-03-13 12:52:15 +01:00
Eelco Dolstra
1212b1fbfe JSONLogger: Log to a file descriptor instead of another Logger
Logging to another Logger was kind of nonsensical - it was really just
an easy way to get it to write its output to stderr, but that only
works if the underlying logger writes to stderr.

This change is needed to make it easy to log JSON output somewhere
else (like a file or socket).
2025-03-13 12:52:15 +01:00
Graham Christensen
f988d9edbf
Merge pull request #12 from DeterminateSystems/update-upgrade-docs
Update upgrade docs
2025-03-12 13:23:41 +00:00
Luc Perkins
70f08ee91c
Merge pull request #11 from DeterminateSystems/revamp-introduction
Change title in introduction
2025-03-12 13:22:54 +00:00
Luc Perkins
b62167a014
Update upgrade docs 2025-03-07 14:53:22 -03:00
Luc Perkins
644f79dfd8
Add installation instructions to intro 2025-03-07 14:18:04 -03:00
Graham Christensen
d1ec1b7eff
Merge pull request #10 from DeterminateSystems/grahamc-patch-1
Publish the flake as public, every time
2025-03-06 23:42:09 +00:00
Graham Christensen
fd6231e612
Publish the flake as public, every time
This exposed a bug in FlakeHub's private toggling, where the public 3.0.0 release followed by an accidentally private 0.1.x release, managed to cause the flake to be shunted closed.

This should not be possible, so let's dig into how that came to be and make sure to create a test case against this should-be-impossible transition.
2025-03-06 15:36:43 -08:00
Luc Perkins
4f6d3299a4
Change document title 2025-03-06 14:42:58 -03:00
Luc Perkins
fea4ee8c5e
Merge pull request #9 from DeterminateSystems/nix-channel-deprecated
Move nix-channel under deprecated commands
2025-03-06 17:37:54 +00:00
Luc Perkins
aaf1967faa
Remove default Nix expression links 2025-03-05 17:49:23 -03:00
Luc Perkins
0f04d36c73
Remove default Nix expression doc from summary 2025-03-05 17:45:11 -03:00
Luc Perkins
d67db97abb
Remove channels link 2025-03-05 17:41:24 -03:00
Luc Perkins
1a5c4d49e4
Merge pull request #8 from DeterminateSystems/uninstallation-instructions
Revamp uninstallation docs
2025-03-05 20:38:27 +00:00
Luc Perkins
e2bc5e3774
Remove default Nix expression doc 2025-03-05 17:37:59 -03:00
Luc Perkins
e6a6bcbb73
Move nix-channel under deprecated commands 2025-03-05 17:30:47 -03:00
Luc Perkins
cef7855523
Fix merge conflict 2025-03-05 17:27:03 -03:00
Luc Perkins
39d99ebaa3
Merge pull request #7 from DeterminateSystems/github-links
Update GitHub links
2025-03-05 20:18:16 +00:00
Luc Perkins
f76ef9d4d3
Merge pull request #6 from DeterminateSystems/nix-installer-recommandation
Recommend only the Determinate Nix Installer
2025-03-05 20:07:26 +00:00
Luc Perkins
42606c16ad
Remove one more reference to binary doc 2025-03-05 16:59:50 -03:00