1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-14 22:42:41 +01:00
Commit graph

21925 commits

Author SHA1 Message Date
John Ericson
c7f17358fc
Merge pull request #14549 from Alexis211/doc/fix-nar-format
doc: fix "Nix Archive (NAR) format" specification
2025-11-12 20:10:17 +00:00
Alex Auvolat
ddc3fba9fb doc: fix "Nix Archive (NAR) format" specification
For executable files in NAR archives, the `executable` tag is followed
by an empty string, which was not indicated correctly in the
specification.

Adding the empty string can be seen in `src/libutil/archive.cc:62`.

Here is an example of a hexdump of a NAR archives where this empty
string can be seen:

```
00000730  65 6e 74 72 79 00 00 00  01 00 00 00 00 00 00 00  |entry...........|
00000740  28 00 00 00 00 00 00 00  04 00 00 00 00 00 00 00  |(...............|
00000750  6e 61 6d 65 00 00 00 00  10 00 00 00 00 00 00 00  |name............|
00000760  6c 69 62 6d 70 66 72 2e  73 6f 2e 36 2e 32 2e 31  |libmpfr.so.6.2.1|
00000770  04 00 00 00 00 00 00 00  6e 6f 64 65 00 00 00 00  |........node....|
00000780  01 00 00 00 00 00 00 00  28 00 00 00 00 00 00 00  |........(.......|
00000790  04 00 00 00 00 00 00 00  74 79 70 65 00 00 00 00  |........type....|
000007a0  07 00 00 00 00 00 00 00  72 65 67 75 6c 61 72 00  |........regular.|
000007b0  0a 00 00 00 00 00 00 00  65 78 65 63 75 74 61 62  |........executab|
000007c0  6c 65 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |le..............|
000007d0  08 00 00 00 00 00 00 00  63 6f 6e 74 65 6e 74 73  |........contents|
000007e0  a0 16 0c 00 00 00 00 00  7f 45 4c 46 02 01 01 00  |.........ELF....|
000007f0  00 00 00 00 00 00 00 00  03 00 3e 00 01 00 00 00  |..........>.....|
00000800  00 00 00 00 00 00 00 00  40 00 00 00 00 00 00 00  |........@.......|
00000810  e0 0e 0c 00 00 00 00 00  00 00 00 00 40 00 38 00  |............@.8.|
00000820  0b 00 40 00 1f 00 1e 00  01 00 00 00 04 00 00 00  |..@.............|
00000830  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
```

(taken from `09zrxnn4j5hjxqj93xvxrl1dpmq4cyajas3yf7a7y0i7h81m6bd4.nar`,
available on `cache.nixos.org`)
2025-11-12 20:16:00 +01:00
John Ericson
af0ac14021
Merge pull request #14544 from Radvendii/evalmemory-alocbytes
move allocBytes() into EvalMemory
2025-11-11 17:29:55 +00:00
Taeer Bar-Yam
7ff3cc65e4 move allocBytes() into EvalMemory 2025-11-11 17:48:07 +01:00
John Ericson
918c1a9e58
Merge pull request #14489 from roberth/shell-a-la-carte
Infer devShell deps, provide smaller one
2025-11-11 16:17:05 +00:00
Jörg Thalheim
091c0a97e1
Merge pull request #14504 from obsidiansystems/json-along-side-rpc-proto-test-data
JSON alongside binary proto serialization test data
2025-11-11 08:12:04 +00:00
John Ericson
f2253a00bc
Merge pull request #14541 from NixOS/correct-error-message
libexpr: Fix error message in forceStringNoCtx
2025-11-11 01:47:48 +00:00
Sergei Zimmerman
a5eba9a354
libexpr: Fix error message in forceStringNoCtx
Otherwise it would print the address of the value.
2025-11-11 04:12:44 +03:00
John Ericson
295ad5c05f
Merge pull request #14503 from obsidiansystems/store-info-transitional
Make `ValidPathInfo`, `NarInfo` JSON instances, but don't yet use in the CLI
2025-11-11 00:20:18 +00:00
John Ericson
204749270b JSON alongside binary proto serialization test data
This makes the proto serializer characterisation test data be
accompanied by JSON data.

This is arguably useful for a reasons:

- The JSON data is human-readable while the binary data is not, so it
  provides some indication of what the test data means beyond the C++
  literals.

- The JSON data is language-agnostic, and so can be used to quickly rig
  up tests for implementation in other languages, without having source
  code literals at all (just go back and forth between the JSON and the
  binary).

- Even though we have no concrete plans to place the binary protocol 1-1
  or with JSON, it is still nice to ensure that the JSON serializers and
  binary protocols have (near) equal coverage over data types, to help
  ensure we didn't forget a JSON (de)serializer.
2025-11-10 18:32:31 -05:00
John Ericson
f5390e76e4 Make ValidPathInfo, NarInfo JSON instances, but don't yet use in the CLI
Make instances for them that share code with `nix path-info`, but do a
slightly different format without store paths containing store dirs
(matching the other latest JSON formats).

Progress on #13570.

If we depend on the store dir, our JSON serializers/deserializers take
extra arguements, and that interfaces with the likes of various
frameworks for associating these with types (e.g. nlohmann in C++, Serde
in Rust, and Aeson in Haskell).

For now, `nix path-info` still uses the previous format, with store
dirs. We may yet decide to "rip of the band-aid", and just switch it
over, but that is left as a future PR.
2025-11-10 18:31:44 -05:00
John Ericson
533db37ebc
Merge pull request #14464 from lovesegfault/nix-s3-storage-class
feat(libstore): add S3 storage class support
2025-11-10 22:54:12 +00:00
John Ericson
d00c419ed6
Merge pull request #14530 from NixOS/nix-develop-cleanups-0
Two cleanups `nix develop`
2025-11-10 22:26:46 +00:00
John Ericson
87a2ce492f
Merge pull request #14535 from Radvendii/parser-cleanup
parser.y cleanup
2025-11-10 22:01:06 +00:00
Eelco Dolstra
d1f750a714 nix develop: getBuildEnvironment return StorePath 2025-11-10 16:41:17 -05:00
Eelco Dolstra
af1db7774f Convert C++ function doc to Doxygen style
Otherwise Doxygen won't pick it up
2025-11-10 16:40:04 -05:00
Taeer Bar-Yam
90ba96a3d6 libexpr: use std::span rather than const std::vector & 2025-11-10 22:06:16 +01:00
John Ericson
750306234d
Merge pull request #14479 from lovesegfault/topo-sort-handle-cycles
refactor(libutil/topo-sort): return variant instead of throwing
2025-11-10 20:50:17 +00:00
Taeer Bar-Yam
2d728f0c56 parser.y: get rid of most nix:: prefix 2025-11-10 21:42:05 +01:00
Taeer Bar-Yam
5ffc9fd253 parser.y: remove pointless std::move()s 2025-11-10 21:42:05 +01:00
John Ericson
68a5110fb9
Merge pull request #14502 from obsidiansystems/more-store-object-info-json-cleanup
More store object info json cleanup
2025-11-10 20:26:12 +00:00
Bernardo Meurer Costa
182ae393d1 refactor(libutil/topo-sort): return variant instead of throwing
The variant has on the left-hand side the topologically sorted vector
and the right-hand side is a pair showing the path and its parent that
represent a cycle in the graph making the sort impossible.

This change prepares for enhanced cycle error messages that can provide
more context about the cycle. The variant approach allows callers to
handle cycles more flexibly, enabling better error reporting that shows
the full cycle path and which files are involved.

Adapted from Lix commit f7871fcb5.

Change-Id: I70a987f470437df8beb3b1cc203ff88701d0aa1b
Co-Authored-By: Maximilian Bosch <maximilian@mbosch.me>
2025-11-10 15:04:45 -05:00
Bernardo Meurer Costa
4e64dea21b
feat(libstore): add S3 storage class support
Add support for configuring S3 storage class via the storage-class
parameter for S3BinaryCacheStore. This allows users to optimize costs
by selecting appropriate storage tiers (STANDARD, GLACIER,
INTELLIGENT_TIERING, etc.) based on access patterns.

The storage class is applied via the x-amz-storage-class header for
both regular PUT uploads and multipart upload initiation.
2025-11-10 20:04:33 +00:00
John Ericson
060a354f22
Merge pull request #14531 from NixOS/fix-14529
Restore isAllowed check in ChrootLinuxDerivationBuilder
2025-11-10 19:27:05 +00:00
Sergei Zimmerman
496e43ec72 Restore isAllowed check in ChrootLinuxDerivationBuilder
This early return was lost in d4ef822add.

By doing some
https://en.wikipedia.org/wiki/Non-virtual_interface_pattern, we can
ensure that we don't make this mistake again --- implementations are no
longer responsible for implementing the caching/memoization mechanism.
2025-11-10 13:43:02 -05:00
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
Robert Hensing
cb5b0c30aa Drop external*Inputs from packages
Get rid of some manual package set resolution in favor of splicing
again, too.

Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
2025-11-07 15:24:26 -05:00