1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-11 04:56:01 +01:00
Commit graph

21895 commits

Author SHA1 Message Date
tomberek
7a60f1429f
Merge pull request #14321 from roberth/nix-flake-check-track-attribute
Track attributes in `nix flake check`
2025-11-10 17:32:10 +00:00
tomberek
65fbb4d975
Merge pull request #14505 from obsidiansystems/output-check-intra-refs
Test output checks referring to other outputs
2025-11-10 17:21:15 +00:00
Eelco Dolstra
070e8ee590
Merge pull request #14368 from NixOS/keep-tarball-cache-open
Move getTarballCache() into fetchers::Settings
2025-11-10 17:18:01 +00:00
tomberek
46b5d2e739
Merge pull request #14501 from obsidiansystems/derivation-version-error
Better version error for JSON derivation decoding
2025-11-10 17:17:13 +00:00
Eelco Dolstra
709a73e7ae
Merge pull request #14492 from NixOS/fix-14429
fetchGit: Drop `git+` from the `url` attribute
2025-11-10 17:16:04 +00:00
Jörg Thalheim
accb564889
Merge pull request #14423 from MarcelCoding/progress-bar-units
progress-bar: use dynamic size units
2025-11-10 17:15:12 +00:00
John Ericson
a786c9eedb
Merge pull request #14442 from glittershark/pascal-strings
Use hybrid C / Pascal strings in the evaluator
2025-11-10 06:33:39 +00:00
Aspen Smith
3bf8c76072 Use hybrid C / Pascal strings in the evaluator
Replace the null-terminated C-style strings in Value with hybrid C /
Pascal strings, where the length is stored in the allocation before the
data, and there is still a null byte at the end for the sake of C
interopt.

Co-Authored-By: Taeer Bar-Yam <taeer@bar-yam.me>
Co-Authored-By: Sergei Zimmerman <sergei@zimmerman.foo>
2025-11-10 01:01:23 -05:00
John Ericson
8c113f80f3 Make string matcher for libexpr texts like others
Forgot to print in one case

Co-authored-by: Aspen Smith <root@gws.fyi>
2025-11-10 00:54:20 -05:00
John Ericson
cbe8ec7bd7
Merge pull request #14470 from NixOS/ctx-type-alias
Encapsulate and slightly optimize string contexts
2025-11-09 21:21:15 +00:00
John Ericson
60667e9e5a
Merge pull request #14525 from NixOS/reset-positions-repl
libexpr: Clear PosTable contents in EvalState::resetFileCache
2025-11-09 21:04:03 +00:00
John Ericson
318eea040f
Encapsulate and slightly optimize string contexts
These steps are done (originally in order, but I squashed it as the end
result is still pretty small, and the churn in the code comments was a
bit annoying to keep straight).

1. Create proper struct type for string contexts on the heap

   This will make it easier to change this type in the future.

2. Make `Value::StringWithContext` iterable

   This make some for loops a lot more terse.

3. Encapsulate `Value::StringWithContext::Context::elems`

   It turns out the iterators we just exposed are sufficient.

4. Make `StringWithContext::Context` length-prefixed instead

   Rather than having a null pointer at the end, have a `size_t` at the
   beginning. This is the exact same size (note that null pointer is
   longer than null byte) and thus takes no more space!

Also, see the new TODO on naming. The thing we already so-named is a
builder type for string contexts, not the on-heap type. The
`fromBuilder` static method reflects what the names ought to be too.

Co-authored-by: Sergei Zimmerman <sergei@zimmerman.foo>
2025-11-09 23:35:38 +03:00
Sergei Zimmerman
a091a8100a
libexpr: Clear PosTable contents in EvalState::resetFileCache
Otherwise PosTable grows indefinitely for each reload. Since
the total input size is limited to 4GB (uint32_t for byte offset PosIdx)
it can get exhausted pretty. This ensures that we don't waste memory
on reloads as well.
2025-11-09 22:09:18 +03:00
John Ericson
6ebaba50dd
Merge pull request #14515 from NixOS/dirOf-dont-call-std-filesystem
libexpr: Don't use nix::dirOf in prim_dirOf (fix 2.23 regression)
2025-11-09 17:12:04 +00:00
John Ericson
18941cb8fa
Merge pull request #14516 from NixOS/honest-characterization-message
tests/functional: Output an actually correct command to accept test c…
2025-11-09 17:10:49 +00:00
Sergei Zimmerman
a33fccf55a
libexpr: Don't use nix::dirOf in prim_dirOf
This gets us back to pre-2.23 behavior of this primop.
Done by inlining the code of `nix::dirOf` from 2.2-maintenance.
2025-11-09 18:56:33 +03:00
Sergei Zimmerman
86f090837b
tests/functional: Add tests for builtins.dirOf
These will change in the next commit to fix the silent regression from 2.23
in the handling of multiple subsequent path separators.
2025-11-09 18:55:11 +03:00
Jörg Thalheim
08a8bae8b3
Merge pull request #14518 from roberth/channel-subdomain
Change channel URLs to channels.nixos.org subdomain
2025-11-09 15:18:07 +00:00
Robert Hensing
f715992346 Change channel URLs to channels.nixos.org subdomain
Update all channel URLs from https://nixos.org/channels/ to
https://channels.nixos.org/ to use the more reliable subdomain.

The nixos.org domain apex lacks IPv6 support due to DNS hoster
limitations. Using the subdomain allows better CDN distribution
and improved reliability.

Updated files:
- Installation scripts (multi-user and tarball installers)
- Channel URL resolution in eval-settings.cc
- Documentation and examples
- Docker image default channel URL
- Release notes (added note about URL change)

Fixes #14517
2025-11-09 15:28:12 +01:00
Sergei Zimmerman
98e61c6da9
tests/functional: Output an actually correct command to accept test changes
I've run into this quite a few times when working with characterization test
infra. It would print an invalid command:

_NIX_TEST_ACCEPT=1 meson test main/lang

Which you'd then proceed to run and it would fail. This commit makes it
be honest about the command you need to run:

_NIX_TEST_ACCEPT=1 meson test --suite main lang
2025-11-09 16:52:51 +03:00
Marcel
0c53c88367
progress-bar: use dynamic size units 2025-11-07 23:50:38 +01:00
Sergei Zimmerman
d6fc64ac38
libfetchers-tests: Add InputFromAttrsTest for #14429
Previous commit fixed an issue. This commit adds a test
to validate that.
2025-11-08 00:17:04 +03:00
John Ericson
479b6b73a9
Merge pull request #14509 from Mic92/no-tbb
build: Disable libstdc++ TBB backend to avoid unnecessary dependency
2025-11-07 20:42:34 +00:00
John Ericson
3c2dcf42e9
Merge pull request #14477 from lovesegfault/http-upload-headers
refactor(libstore): pass headers into upload methods
2025-11-07 20:41:14 +00:00
John Ericson
5a97c00f29
Merge pull request #14499 from roberth/genericClosure-errors
`builtins.genericClosure`: improve errors
2025-11-07 20:10:34 +00:00
Jörg Thalheim
2f3ec16793 build: Disable libstdc++ TBB backend to avoid unnecessary dependency
boost::concurrent_flat_map (used in libutil and libstore) includes the
C++17 <execution> header. GCC's libstdc++ implements parallel algorithms
using Intel TBB as the backend, which creates a link-time dependency on
libtbb even though we don't actually use any parallel algorithms.

Disable the TBB backend for libstdc++ by setting
_GLIBCXX_USE_TBB_PAR_BACKEND=0. This makes parallel algorithms fall back
to serial execution, which is acceptable since we don't use them anyway.

This only affects libstdc++ (GCC's standard library); other standard
libraries like libc++ (LLVM) are unaffected.
2025-11-07 20:58:46 +01:00
John Ericson
c5f348db95 Test output checks referring to other outputs
`allowedReferences` and friends can, in addition to supporting store
paths (and placeholders, but because those will be rewritten to store
paths), they also support to refering to other outputs in the derivation
by name.

We update the tests in order to cover for that.

(While we are at it, also introduce some scratch variables for paths and
placeholders to make the C++ literalsf for this test more concise.)
2025-11-07 00:17:37 -05:00
John Ericson
80b1d7b87a Better version error for JSON derivation decoding
It now says which (other) version was encountered instead
2025-11-06 19:29:43 -05:00
Robert Hensing
3ee8e45f8e tests: Replace fragile genericClosure unit tests
We now have functional tests for these. The unit tests added negligible
value while imposing a much higher maintenance cost.

The maintenance cost is high:
  - No automatic accept option
  - They broke 5+ times during this session due to implementation changes (trace count, ordering)
  - They require understanding ANSI escape codes, Uncolored() wrappers, trace reversal
  - They test empty traces HintFmt("") from withTrace(pos, "") - pure implementation detail
  - They're fragile: adding any trace anywhere breaks the exact count assertions

The additional value over functional tests is minimal:
  - Functional tests already verify the error message
  - Functional tests already show trace order and content (as users see it, helps review)
  - Unit tests verify "exactly 3 traces, not 2 or 4" - but users don't count traces
  - Unit tests verify empty traces exist - but users never see them

The white-box testing catches the wrong things:
  - It catches "you added helpful context" as a failure
  - It doesn't catch "the context is confusing" (which functional tests would show)
  - It enforces implementation details that should be allowed to evolve
2025-11-07 00:27:39 +01:00
Robert Hensing
d262efc240 libexpr: improve error messages for builtins.genericClosure
Show which element(s) are involved at each error point:

- When an element is missing the "key" attribute, show the element
- When an element is not an attribute set, show the element
- When comparing keys fails, show both elements being compared
- When calling operator fails, show which element was being processed

This provides concrete context using ValuePrinter with errorPrintOptions.

Note: errorPrintOptions uses maxDepth=10 by default, which may print
quite deeply nested structures in error messages. This could potentially
be overwhelming, but follows the existing default for error contexts.
2025-11-06 22:28:49 +01:00
John Ericson
5b15544bdd
Merge pull request #14493 from obsidiansystems/drv-and-path-info-new-fmts
Modifications to the JSON formats for `Derivation` and `ValidPathInfo`
2025-11-06 21:09:27 +00:00
Robert Hensing
ca787bc3e0 tests: add error tests for builtins.genericClosure
Covers error conditions for:
- Invalid argument types (not an attrset)
- Missing required attributes (startSet, operator)
- Type mismatches (startSet/operator not correct type)
- Element validation (elements not attrsets, missing key attribute)
- Key comparison errors (incompatible types, uncomparable types)
- Operator return value validation (not a list)
2025-11-06 21:33:41 +01:00
John Ericson
8cc3ede0fa Add change-log entry for derivation format changes 2025-11-06 15:19:44 -05:00
John Ericson
caa196e31d Make the store path info ca field structured in JSON
The old string format is a holdover from the pre JSON days. It is not
friendly to users who need to get the information out of it.

Also introduce the sort of versioning we have for derivation for this
format too.
2025-11-06 15:19:44 -05:00
John Ericson
0c37a62207 Change JSON derivation format in two ways
- Use canonical content address JSON format for floating content
  addressed derivation outputs

  This keeps it more consistent.

- Reorganize inputs into nested structure (`inputs.srcs` and
  `inputs.drvs`)

  This will allow for an easier to use, but less compact, alternative
  where `srcs` is just a list of derived paths.

  It also allows for other experiments for derivations with a different
  input structure, as I suspect will be needed for secure build traces.
2025-11-06 15:19:44 -05:00
John Ericson
147e183c68
Merge pull request #14426 from obsidiansystems/json-schema-build-result
JSON Impl and schema for BuildResult
2025-11-06 18:40:35 +00:00
Eelco Dolstra
52b2909fd2
Merge pull request #14491 from NixOS/fix-14311
Don't crash on flakerefs containing newlines
2025-11-06 18:29:44 +00:00
Jörg Thalheim
34c77ffe38
Merge pull request #14471 from obsidiansystems/derivation-options-json-test
FIx `DerivationOptions` JSON and clean up unit tests
2025-11-06 18:21:15 +00:00
John Ericson
af8e44821e
Merge pull request #14490 from obsidiansystems/derivation-builder-no-inputs
`DerivationBuilderParams` have reference to `BasicDerivation`
2025-11-06 18:15:56 +00:00
Jörg Thalheim
70fbd1cdf4
Merge pull request #14465 from obsidiansystems/split-realisation-protocol-tests
Split realisation protocol unit tests
2025-11-06 18:14:25 +00:00
Jörg Thalheim
daace78239
Merge pull request #14425 from obsidiansystems/json-schema-build-trace
JSON Schema for build trace entry
2025-11-06 18:06:57 +00:00
Sergei Zimmerman
d596b9754e
Merge pull request #14472 from Radvendii/exprs-alloc
libexpr: allocate the Exprs themselves in Exprs::alloc
2025-11-06 17:29:09 +00:00
Eelco Dolstra
40f600644d fetchGit: Drop git+ from the url attribute
This was already dropped in `inputFromURL()`, but not in
`inputFromAttrs()`. Now it's done in `fixGitURL()`, which is used by
both.

In principle, `git+` shouldn't be used in the `url` attribute, since
we already know that it's a Git URL. But since it currently works, we
don't want to break it.

Fixes #14429.
2025-11-06 16:34:19 +01:00
Eelco Dolstra
c1317017e9 Don't crash on flakerefs containing newlines
Fixes #14311.
2025-11-06 13:06:38 +01:00
Jörg Thalheim
3f18cad5f1
Merge pull request #14459 from jfroche/fix/macos-ipcs
Fix macOS IPC cleanup in builder
2025-11-06 09:31:53 +00:00
Jörg Thalheim
41b62aa979
Merge pull request #14445 from CyberShadow/nix-flake-check-log-success
nix flake check: log success in verbose mode
2025-11-06 09:30:55 +00:00
Jörg Thalheim
af41eccb31
Merge pull request #14469 from roberth/doc-check-link-fragments
Manual: fix and check link fragments
2025-11-06 09:27:19 +00:00
John Ericson
e7b274f85a DerivationBuilderParams have reference to BasicDerivation
Have one to that instead of one to `Derivation`. `DerivationBuilder`
doesn't need `inputDrvs`, so `BasicDerivation` suffices.

(In fact, it doesn't need `inputSrcs` either, but we don't yet hve a
type to exclude that.)
2025-11-05 23:41:47 -05:00
John Ericson
6bd92d47e5
Merge pull request #14488 from Mic92/kaitai-struct
nix-kaitai-struct: make it not longer part of the devshell
2025-11-05 21:57:29 +00:00
Sergei Zimmerman
b5302fc111
Merge pull request #14487 from NixOS/git-show-progress
Git fetcher: Restore progress indication
2025-11-05 21:32:58 +00:00