1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-06 21:41:48 +02:00
Commit graph

18253 commits

Author SHA1 Message Date
Eelco Dolstra
a9020404cf select() -> poll() for Windows compat
(cherry picked from commit 270c8469d7)
2025-01-10 10:36:06 +00:00
Eelco Dolstra
77a71c518f Update src/libutil/serialise.hh
Co-authored-by: John Ericson <git@JohnEricson.me>
(cherry picked from commit ce7cf4a2d3)
2025-01-10 10:36:06 +00:00
Eelco Dolstra
36f3fb72e9 withFramedSink(): Don't use a thread to monitor the other side
Since withFramedSink() is now used a lot more than in the past (for
every addToStore() variant), we were creating a lot of threads, e.g.

  nix flake show --no-eval-cache --all-systems github:NixOS/nix/afdd12be5e19c0001ff3297dea544301108d298

would create 46418 threads. While threads on Linux are cheap, this is
still substantial overhead.

So instead, just poll from FramedSink before every write whether there
are pending messages from the daemon. This could slightly increase the
latency on log messages from the daemon, but not on exceptions (which
were only synchronously checked from FramedSink anyway).

This speeds up the command above from 19.2s to 17.5s on my machine (a
9% speedup).

(cherry picked from commit 39daa4a0d3)
2025-01-10 10:36:05 +00:00
mergify[bot]
e0c8b0fc4f
Merge pull request #12150 from NixOS/mergify/bp/2.24-maintenance/pr-12143
mergify: fix installer test name (backport #12143)
2025-01-07 19:42:11 +00:00
Jörg Thalheim
55dc2a9c9a mergify: fix installer test name
(cherry picked from commit 438a20427f)
2025-01-07 19:18:05 +00:00
Jörg Thalheim
112d0a7d85
Merge pull request #12144 from NixOS/mergify/bp/2.24-maintenance/pr-12046
CLI symlink fixes (backport #12046)
2025-01-07 08:06:58 +01:00
Jörg Thalheim
b59b317e47
Merge pull request #12136 from NixOS/mergify/bp/2.24-maintenance/pr-11876
Filter OSC 8 correctly (backport #11876)
2025-01-07 07:22:37 +01:00
Jörg Thalheim
1eda38420f
Merge pull request #11743 from NixOS/mergify/bp/2.24-maintenance/pr-11729
nix/tests: run test help.sh only if nix is built with documentation (backport #11729)
2025-01-07 07:21:51 +01:00
Robert Hensing
caeec0404e test: Avoid regressing accidental use of weakly_canonical instead of makeParentCanonical
I'd messed up a rebase in my previous iteration, causing `weakly_canonical` to reappear,
but not trigger a test failure.

These two functions behave similarly when the argument is a path that points to a broken
symlink. `weakly_canonical` would not resolve it because the target doesn't exist, and
`makeParentCanonical` would not resolve it, because it never resolves the final path
element.
This new test case now also tests a valid symlink, "differentiating" the two.

(cherry picked from commit 4c74d679b6)
2025-01-07 07:20:55 +01:00
Jörg Thalheim
f145dde10b makeParentCanonical: test case where parent is empty
(cherry picked from commit 5a5a86949a)

# Conflicts:
#	src/libutil-tests/file-system.cc
2025-01-07 07:20:55 +01:00
Robert Hensing
73dd3db039 test: Add hydraJobs.tests.functional_symlinked-home
(cherry picked from commit 628c11d237)
2025-01-07 07:20:55 +01:00
Robert Hensing
e31d071793 fix: Resolve CLI parent symlinks before adding to store
Fixes https://github.com/NixOS/nix/issues/11941

(cherry picked from commit ddbbf53767)
2025-01-07 07:20:55 +01:00
Robert Hensing
42104d650a refactor: Don't re-construct SourcePath unnecessarily
(cherry picked from commit c0b64f3377)
2025-01-07 07:20:55 +01:00
Robert Hensing
129f8aaab2 doc: Document nix-store --add-fixed symlink behavior
Tested with

    nix run nix/2.3-maintenance#nix-store -- --add some_symlink
    nix run nix/2.3-maintenance#nix-store -- --add-fixed sha256 --recursive some_symlink

(cherry picked from commit 91e91f62fa)
2025-01-07 07:20:55 +01:00
Robert Hensing
b9c30a9c87 fix: Handle symlinks and FIFOs in nix hash where possible
Fixes https://github.com/NixOS/nix/issues/11756
Fixes https://github.com/NixOS/nix/issues/11681

(cherry picked from commit 36563c69a4)
2025-01-07 07:20:55 +01:00
Robert Hensing
fa3fd41063 Add makeParentCanonical()
(cherry picked from commit 69853c067c)
2025-01-07 07:20:55 +01:00
Marian Hammer
e79d66ceef nix/tests: run test help.sh only if nix is built with documentation
tests/functional/help.sh calls nix-* commands with option --help
if nix is built without documentation the option --help throws an error
because the man page it wants to display is missing

(cherry picked from commit 85b0cd320a)
2025-01-07 05:55:13 +00:00
Jack Wilsdon
e144f61ec0 Filter OSC 8 correctly
This allows Nix to use lowdown 1.2.0 which outputs OSC-8 links.

(cherry picked from commit 1301f8434d)
2025-01-07 05:33:19 +00:00
Jörg Thalheim
2c89c38fa1
Merge pull request #12074 from NixOS/mergify/bp/2.24-maintenance/pr-12059
installer: make sure we can always test the installer in ci and locally (backport #12059)
2025-01-07 00:27:16 +01:00
Robert Hensing
1a710e54dc .github/ci: Use fixed names
This lets us update "runs-on" without creating a mismatch with the
required checks that are configured for the repo in the github ui.
2025-01-07 00:04:32 +01:00
NAHO
365e0a9ab1 ci: lock macOS runner to macos-14 2025-01-07 00:04:32 +01:00
NAHO
b3ea1e9b19 ci: update Ubuntu runner to ubuntu-24.04
Link: https://github.com/actions/runner-images/issues/10636
2025-01-07 00:04:32 +01:00
NAHO
c78b818a0c ci: lock Ubuntu runner to ubuntu-22.04
Lock the Ubuntu runner to ubuntu-22.04 to avoid accidental updates [1]
and increase reproducibility.

[1]: https://github.com/actions/runner-images/issues/10636
2025-01-07 00:04:32 +01:00
Jörg Thalheim
3109250faf mergify: updated required tests
(cherry picked from commit df3eb4f3f6)
2025-01-07 00:04:32 +01:00
Jörg Thalheim
2fbd0a943c installer: make sure we can always test the installer in ci and locally
Just now there is a dependency on cachix, which means we cannot test
the installer in CI if forks do not have the necessary secrets set up.
We replace this with a simple http server that serves the installer and
can be both used in CI and locally.

(cherry picked from commit 6162e1220e)
2025-01-07 00:04:32 +01:00
mergify[bot]
bda59dee55
Merge pull request #12077 from NixOS/mergify/bp/2.24-maintenance/pr-12045
EvalState::realiseContext(): Allow access to the entire closure (backport #12045)
2024-12-31 15:33:23 +00:00
Robert Hensing
000db53f8f tests/functional: Add $config_nix 2024-12-31 15:14:56 +01:00
mergify[bot]
e40d0352b2
Merge pull request #12118 from NixOS/mergify/bp/2.24-maintenance/pr-12115
libcmd: update to support lowdown-1.4 API (backport #12115)
2024-12-30 20:26:40 +00:00
Sergei Trofimovich
c530b13321 libcmd: update to support lowdown-1.4 API
Upstream change
bab1d75079
moved a few fields from `lowdown_opts` toa  new `lowdown_opts_term`
struct. As a result the build started failing as:

    nix-cmd> [2/17] Compiling C++ object libnixcmd.so.p/markdown.cc.o
    nix-cmd> FAILED: libnixcmd.so.p/markdown.cc.o
    nix-cmd> g++ -Ilibnixcmd.so.p -I. -I.. -I/nix/store/b0bnrk5lacxbpgxgnc28r8q3wcazrgxj-nix-util-2.26.0pre-dev/include/nix -I/nix/store/cxnynq9ykyj4xxv6wf6dw7r0aw5x6n9k-libarchive-3.7.7-dev/include -I/nix/store/bfgjwkcb8snkizx578rzdahi75m8zyh4-nlohmann_json-3.11.3/include -I/nix/store/3sx8bq3sip6j2nv1m5xx4gbdp33v7iy6-nix-store-2.26.0pre-dev/include/nix -I/nix/store/sih2dgqzvsbv7p510lkfmas7s7wbsl4j-nix-fetchers-2.26.0pre-dev/include/nix -I/nix/store/68p8s20fsiiakj7nys7grbaixfnhsdzs-nix-expr-2.26.0pre-dev/include/nix -I/nix/store/gw7wknhzhfzzj9zww2kyi5xrzgf1ndki-boehm-gc-8.2.8-dev/include -I/nix/store/3jwb9j4vnsk5saq3wfyyp9il3mhs41l9-nix-flake-2.26.0pre-dev/include/nix -I/nix/store/8nwjvmq7m48v8g646jrxkikv6x47bc3m-nix-main-2.26.0pre-dev/include/nix -I/nix/store/rb0hzsw5wc1a7daizhpj824mbxlvijrq-lowdown-1.4.0-dev/include -I/nix/store/m388ywpk53fsp8r98brfd7nf1f5sskv0-editline-1.17.1-dev/include -fdiagnostics-color=always -D_GLIBCXX_ASSERTIONS=1 -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++2a -include config-util.hh -include config-store.hh -include config-expr.hh -include config-main.hh -include config-cmd.hh -Wdeprecated-copy -Werror=suggest-override -Werror=switch -Werror=switch-enum -Werror=unused-result -Wignored-qualifiers -Wimplicit-fallthrough -Wno-deprecated-declarations -O3 -fPIC -pthread -std=c++2a -std=c++2a -std=c++2a -std=c++2a -std=c++2a -std=c++2a -MD -MQ libnixcmd.so.p/markdown.cc.o -MF libnixcmd.so.p/markdown.cc.o.d -o libnixcmd.so.p/markdown.cc.o -c ../markdown.cc
    nix-cmd> ../markdown.cc: In function 'std::string nix::doRenderMarkdownToTerminal(std::string_view)':
    nix-cmd> ../markdown.cc:28:5: error: 'lowdown_opts' has no non-static data member named 'cols'
    nix-cmd>    28 |     };
    nix-cmd>       |     ^

The change adds version-based conditional to support both pre-1.4 and
1.4 forms of the initialization.

Closes: https://github.com/NixOS/nix/issues/12113
(cherry picked from commit edbfe863ce)
2024-12-30 19:16:43 +00:00
Eelco Dolstra
a924db7d0b
Resolve merge conflict 2024-12-16 18:01:52 +01:00
Eelco Dolstra
f986f7e89b EvalState::realiseContext(): Allow access to the entire closure
Fixes #11030.

(cherry picked from commit 08361f031d)

# Conflicts:
#	src/libexpr/eval.cc
#	tests/functional/import-from-derivation.nix
#	tests/functional/import-from-derivation.sh
2024-12-16 15:36:40 +00:00
Jörg Thalheim
6a791e946f
Merge pull request #11904 from NixOS/mergify/bp/2.24-maintenance/pr-11902
Fix issue #11892 (backport #11902)
2024-12-16 13:22:30 +01:00
mergify[bot]
aa22f98b25
Merge pull request #12054 from NixOS/mergify/bp/2.24-maintenance/pr-12050
speed up ci by splitting off eval and build + fix ci with restricted namespaces (backport #12050)
2024-12-14 15:46:25 +00:00
Jörg Thalheim
b3dc855569 ci: disable apparmor restrictions
For our tests we need to map the root user for some tests.
However ubuntu no longer allows this by default:
https://ubuntu.com/blog/ubuntu-23-10-restricted-unprivileged-user-namespaces

(cherry picked from commit 9f2b9256b6)
2024-12-14 15:24:48 +00:00
Jörg Thalheim
7bafbfd50e binary-tarball: create tarball without listing files
This is producing quite a bit of log output in CI.

(cherry picked from commit 31b3a34e5b)
2024-12-14 15:24:48 +00:00
Jörg Thalheim
578f185daf speed up ci by splitting off eval and build
- This speeds up macOS builds from 30 minutes to 11 minutes (3x faster).
- Also improve error reporting e.g. printing out what actually failed to build.
- As a result we also no longer need swap.

(cherry picked from commit 691b1ea237)
2024-12-14 15:24:48 +00:00
Eelco Dolstra
628961d136 Bump version 2024-12-10 17:11:49 +01:00
Jörg Thalheim
a4f978bd9b
Merge pull request #12034 from NixOS/mergify/bp/2.24-maintenance/pr-11921
Make @nix json structured build log parsing warn instead of fail (backport #11921)
2024-12-10 05:37:28 +01:00
Robert Hensing
180031fb5a tests: Make unusual logging test conditional on fixed daemon version
(cherry picked from commit c783cd22ac)
2024-12-10 00:12:19 +01:00
Robert Hensing
29d91db99c Remove redundant warning: prefix from structured build log warning
(cherry picked from commit f3c722cab2)
2024-12-09 21:40:12 +00:00
Robert Hensing
6b2722fc84 test: Move unusual-logging to run only in logging test case
(cherry picked from commit 1421420e86)
2024-12-09 21:40:07 +00:00
Robert Hensing
c951bb0689 Push log source description out of libutil and report build hook @nix warning correctly
(cherry picked from commit 03d4bfd852)
2024-12-09 21:40:04 +00:00
Robert Hensing
60eadfac7f tests/functional/dependencies.nix: Check that we tolerate syntax and type errors
(cherry picked from commit 1485937b89)
2024-12-09 21:40:00 +00:00
Linus Heckemann
9fed865d1d libutil: handle json builder log messages with unexpected format
Before this change, expressions like:

with import <nixpkgs> {};
runCommand "foo" {} ''
  echo '@nix {}' >&$NIX_LOG_FD
''

would result in Lix crashing, because accessing nonexistent fields of
a JSON object throws an exception.

Rather than handling each field individually, we just catch JSON
exceptions wholesale. Since these log messages are an unusual
circumstance, log a warning when this happens.

Fixes #544.

Change-Id: Idc2d8acf6e37046b3ec212f42e29269163dca893
(cherry picked from commit e55cd3beea710db727fd966f265a1b715b7285f3)
(cherry picked from commit ee03fd478e)
2024-12-09 21:39:58 +00:00
Robert Hensing
3cd4e9de1e tests/functional/dependencies.nix: Refactor, replace arcane let
(cherry picked from commit e82ff51726)
2024-12-09 21:39:55 +00:00
Eelco Dolstra
0f8fef49c3
Merge pull request #12017 from NixOS/mergify/bp/2.24-maintenance/pr-12013
nix hash convert: Support SRI hashes that lack trailing '=' characters (backport #12013)
2024-12-09 13:14:14 +01:00
Eelco Dolstra
bd1b11ec66
Resolve conflict 2024-12-06 12:13:12 +01:00
Eelco Dolstra
6a8e9736e0 nix hash: Don't print 'nix hash' deprecation message
Fixes #11997.

(cherry picked from commit 408c2faf93)

# Conflicts:
#	src/nix/hash.cc
2024-12-05 22:30:24 +00:00
Eelco Dolstra
dd79a490bf nix hash convert: Don't fail on uppercase base-16 hashes
(cherry picked from commit 33b645cedf)
2024-12-05 22:30:24 +00:00
Eelco Dolstra
00d0e63c61 nix hash convert: Support SRI hashes that lack trailing '=' characters
Fixes #11996.

(cherry picked from commit 52f1cd0595)
2024-12-05 22:30:24 +00:00