John Ericson
91593a237f
Convert Realisation JSON logic to standard style
...
No behavior is changed, just:
- Declare a canonical `nlohmnan::json::adl_serializer`
- Use `json-utils.hh` to shorten code without getting worse error
messages.
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2025-09-22 12:59:37 -04:00
John Ericson
6389f65d63
Rework derivation format release note slightly
2025-09-22 12:59:37 -04:00
Robert Hensing
169a368459
Merge pull request #14040 from NixOS/import-thunk
...
Ensure that files are parsed/evaluated only once (2nd attempt)
2025-09-22 18:33:00 +02:00
Eelco Dolstra
a0103fc302
Merge pull request #13852 from lovesegfault/warn-no-kvm
...
feat(libstore): warn when kvm is enabled but /dev/kvm isn't available
2025-09-22 18:31:57 +02:00
Jörg Thalheim
dcaf001d52
Merge pull request #14021 from jfroche/fix/installer-shell-path
...
installer: prepend nix paths to shell config files instead of appending
2025-09-22 18:27:03 +02:00
John Ericson
74b31d10db
Merge pull request #14042 from corngood/cygwin-cross
...
fix cross build for cygwin
2025-09-22 11:55:40 -04:00
David McFarland
32d4ea8140
fix cross-build for cygwin
2025-09-22 12:27:04 -03:00
Eelco Dolstra
d32d77f4d4
Allocate ExprParseFile on the heap for now
...
https://github.com/NixOS/nix/pull/14013#issuecomment-3308085755
2025-09-22 12:06:51 +02:00
Robert Hensing
28c0089268
Merge pull request #14039 from NixOS/document-expr-methods
...
libexpr: Document {eval,maybeThunk} methods
2025-09-22 11:59:55 +02:00
Eelco Dolstra
5f60602875
Reapply "Merge pull request #13938 from NixOS/import-thunk"
...
This reverts commit fd034814dc .
2025-09-22 11:48:58 +02:00
Robert Hensing
71b27774f0
libexpr: Document {eval,maybeThunk} methods
2025-09-22 01:41:02 +03:00
Robert Hensing
ab7feb3898
Merge pull request #14023 from NixOS/dummy-store-path-info
...
Make dummy store also store path info
2025-09-21 16:58:18 +02:00
Sergei Zimmerman
a453a49043
tests: Tests for writeable dummy in-memory store
2025-09-21 13:36:31 +03:00
Sergei Zimmerman
b66c357b58
libstore: Implement DummyStore::narFromPath
2025-09-21 13:19:50 +03:00
Sergei Zimmerman
3a4c618483
libstore: Fix typo in description of dummy store
2025-09-21 13:19:49 +03:00
Sergei Zimmerman
ed9b377928
libstore: Disable path info cache for dummy store
2025-09-21 13:19:48 +03:00
Sergei Zimmerman
341878ce0f
libstore: Make dummy store also store path info
2025-09-21 13:19:47 +03:00
Sergei Zimmerman
02c9ac445f
libutil: Improve handling of non-directory root in MemorySourceAccessor
2025-09-21 13:19:45 +03:00
John Ericson
4df60e639b
Use shared pointers in the memory source accessor
...
This allows aliasing, like hard links.
2025-09-21 13:19:44 +03:00
John Ericson
f66b56ad3f
Merge pull request #14035 from NixOS/github-fetcher-accessor
...
libfetchers/github: Use getFSAccessor for downloadFile result
2025-09-20 21:42:54 -04:00
Sergei Zimmerman
e04381edbd
libfetchers/github: Use getFSAccessor for downloadFile result
...
We should use proper abstractions for reading files from the store.
E.g. this caused errors when trying to download github flakes into
an in-memory store in #14023 .
2025-09-21 01:12:42 +03:00
Robert Hensing
d8d1fb0e34
Merge pull request #14029 from roberth/enable-libexpr-tests
...
libexpr-tests: Enable when test setup for building succeeds
2025-09-20 00:57:15 +02:00
Robert Hensing
2d1b412e5b
libexpr-tests: Enable when test setup for building succeeds
...
Accidentally disabled by 9bc218ca3f
2025-09-19 23:39:00 +02:00
John Ericson
773dd61d1c
Merge pull request #14026 from lovesegfault/s3-url-tests
...
test(libstore): additional ParsedS3Url tests
2025-09-19 17:08:36 -04:00
Bernardo Meurer Costa
b63d9fbc87
test(libstore): additional ParsedS3Url tests
...
Extracted from the work in #13752
2025-09-19 20:52:44 +00:00
Jean-François Roche
a408bc3e30
installer: prepend nix paths to shell config files instead of appending
...
Some distribution will stop evaluating the shell config file if
they are not running in an interactive shell. As we append the nix
paths to the end of the file, they will not be evaluated.
We better prepend the nix paths to the shell config files to be sure
that once nix is installed, nix path will be available in any shell.
Note that this is already the case for the detsys installer script for
a while: https://github.com/DeterminateSystems/nix-installer/pull/148
Possibly related errors:
https://github.com/NixOS/nix/issues/8061
https://github.com/NixOS/nix/pull/6628
https://github.com/NixOS/nix/issues/2587
2025-09-19 14:06:06 +02:00
Jörg Thalheim
07b96c1d14
Merge pull request #14018 from NixOS/fix-soname-for-real
...
meson: Fix SONAME for unstable versions
2025-09-19 13:01:04 +02:00
John Ericson
936334638d
Merge pull request #14020 from xokdvium/dummy-store-fixes
...
libstore: Set display prefix for dummy store
2025-09-19 00:00:00 -04:00
John Ericson
8719c2e6b7
Merge pull request #14016 from xokdvium/asan
...
treewide: Support builds with ASAN, enable in CI
2025-09-18 23:48:23 -04:00
Sergei Zimmerman
72e2b0efea
libstore: Set display prefix for dummy store
...
Otherwise the prefix is «unknown».
2025-09-19 02:28:59 +03:00
Sergei Zimmerman
d5e84383d1
doc: Document building with sanitizers
2025-09-19 01:37:15 +03:00
Sergei Zimmerman
94d37e62fc
treewide: Support builds with ASAN, enable in CI
...
Enables builds with ASAN to catch memory corruption
bugs faster and in CI. This is an incredibly valuable
instrument that must be used as much as possible.
Somewhat based on jade's work from Lix, though there's a lot that
we have to do differently:
19ae87e5ce
Co-authored-by: Jade Lovelace <lix@jade.fyi>
2025-09-19 01:33:57 +03:00
Sergei Zimmerman
7dbfe9f576
meson: Fix SONAME for unstable versions
...
Replacing the string is not enough [^] for e.g. nixpkgs precise versions:
`2.31pre20250712_b1245123`
[^]: https://github.com/NixOS/nixpkgs/pull/444089
2025-09-18 23:34:27 +03:00
Jörg Thalheim
3a687eeb4f
Merge pull request #14015 from eclairevoyant/doc-global-builtins
...
doc: document global builtins
2025-09-18 08:11:18 +02:00
Jörg Thalheim
4808b0e24f
Merge pull request #14014 from xokdvium/fish delete
...
libexpr-c: Fix mismatched new/delete
2025-09-18 08:08:39 +02:00
éclairevoyant
40b47b9395
doc: document global builtins
2025-09-18 00:04:31 -04:00
Sergei Zimmerman
309d55807c
libexpr-c: Fix mismatched new/delete
...
This leads to ASAN errors:
==1137785==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x523000001d00 in thread T0:
object passed to delete has wrong type:
size of the allocated type: 5968 bytes;
size of the deallocated type: 5968 bytes.
alignment of the allocated type: 8 bytes;
alignment of the deallocated type: default-aligned.
2025-09-18 02:58:32 +03:00
Jörg Thalheim
9d8c6a6646
Merge pull request #14013 from xokdvium/revert-13938
...
Revert "Merge pull request #13938 from NixOS/import-thunk"
2025-09-18 01:23:14 +02:00
Sergei Zimmerman
fd034814dc
Revert "Merge pull request #13938 from NixOS/import-thunk"
...
This has multiple dangling pointer issues that lead to segfaults in e.g.:
nix eval --expr '(builtins.getFlake "github:nixos/nixpkgs/25.05")' --impure
This reverts commit ad175727e4 , reversing
changes made to d314750174 .
2025-09-18 01:52:46 +03:00
Robert Hensing
b4fcb64276
Merge pull request #13980 from obsidiansystems/drv-json-issue-13570
...
Make the JSON format for derivation use basename store paths
2025-09-17 23:31:41 +02:00
Robert Hensing
82315c3807
Merge pull request #13987 from xokdvium/bindings-bananza
...
libexpr: Structural sharing of attrsets
2025-09-17 23:15:05 +02:00
Sergei Zimmerman
0ccb00bb81
libexpr: Add release note for c-api-byidx change
2025-09-17 23:54:46 +03:00
Sergei Zimmerman
6138bc3de3
libexpr: Structural sharing of attrsets
...
This changes the implementation of Bindings to allow
for a more space-efficient implementation of attribute
set merges. This is accomplished by "layering" over the "base" Bindings.
The top "layer" is naturally the right-hand-side of the update operator //.
Such an implementation leads to significantly better memory usage on
something like nixpkgs:
nix-env --query --available --out-path --file ../nixpkgs --eval-system x86_64-linux > /dev/null
Comparison against 2b0fd88324 for x86_64-linux on nixpkgs f06c7c3b6f5074dbffcf02542fb86af3a5526afa:
| metric | mean_before | mean_after | mean_diff | mean_%_change | p_value | t_stat |
| - | - | - | - | - | - | - |
| cpuTime | 21.1520 | 21.3414 | 0.1894 | 0.7784 | 0.3190 | 1.0219 |
| envs.bytes | 461451951.6190 | 461451951.6190 | - | - | - | - |
| envs.elements | 34344544.8571 | 34344544.8571 | - | - | - | - |
| envs.number | 23336949.0952 | 23336949.0952 | - | - | - | - |
| gc.cycles | 7.5238 | 7.2857 | -0.2381 | -4.6825 | 0.0565 | -2.0244 |
| gc.heapSize | 1777848124.9524 | 1252162023.6190 | -525686101.3333 | -29.9472 | 0.0000 | -8.7041 |
| gc.totalBytes | 3102787383.6190 | 2498431578.6667 | -604355804.9524 | -19.7704 | 0.0000 | -9.3502 |
| list.bytes | 59928225.9048 | 59928225.9048 | - | - | - | - |
| list.concats | 1240028.2857 | 1240028.2857 | - | - | - | - |
| list.elements | 7491028.2381 | 7491028.2381 | - | - | - | - |
| nrAvoided | 28165342.2381 | 28165342.2381 | - | - | - | - |
| nrExprs | 1577412.9524 | 1577412.9524 | - | - | - | - |
| nrFunctionCalls | 20970743.4286 | 20970743.4286 | - | - | - | - |
| nrLookups | 10867306.0952 | 10867306.0952 | - | - | - | - |
| nrOpUpdateValuesCopied | 61206062.0000 | 25748169.5238 | -35457892.4762 | -58.8145 | 0.0000 | -8.9189 |
| nrOpUpdates | 2167097.4286 | 2167097.4286 | - | - | - | - |
| nrPrimOpCalls | 12337423.4286 | 12337423.4286 | - | - | - | - |
| nrThunks | 29361806.7619 | 29361806.7619 | - | - | - | - |
| sets.bytes | 1393822818.6667 | 897587655.2381 | -496235163.4286 | -36.7168 | 0.0000 | -9.1115 |
| sets.elements | 84504465.3333 | 48270845.9524 | -36233619.3810 | -43.8698 | 0.0000 | -8.9181 |
| sets.number | 5218921.6667 | 5218921.6667 | - | - | - | - |
| sizes.Attr | 16.0000 | 16.0000 | - | - | - | - |
| sizes.Bindings | 8.0000 | 24.0000 | 16.0000 | 200.0000 | - | inf |
| sizes.Env | 8.0000 | 8.0000 | - | - | - | - |
| sizes.Value | 16.0000 | 16.0000 | - | - | - | - |
| symbols.bytes | 1368494.0952 | 1368494.0952 | - | - | - | - |
| symbols.number | 109147.1905 | 109147.1905 | - | - | - | - |
| time.cpu | 21.1520 | 21.3414 | 0.1894 | 0.7784 | 0.3190 | 1.0219 |
| time.gc | 1.6011 | 0.8508 | -0.7503 | -37.1507 | 0.0017 | -3.6328 |
| time.gcFraction | 0.0849 | 0.0399 | -0.0450 | -37.4504 | 0.0035 | -3.3116 |
| values.bytes | 615968144.7619 | 615968144.7619 | - | - | - | - |
| values.number | 38498009.0476 | 38498009.0476 | - | - | - | - |
Overall this does slow down the evaluator slightly (no more than ~10% in most cases),
but this seems like a very decent tradeoff for shaving off 33% of memory usage.
2025-09-17 23:54:45 +03:00
John Ericson
9d7229a2a4
Make the JSON format for derivation use basename store paths
...
See #13570 for details --- the idea is that included the store dir in
store paths makes systematic JSON parting with e.g. Serde, Aeson,
nlohmann, or similiar harder.
After talking to Eelco, we are changing the `Derivation` format right
away because not only is `nix derivation` technically experimental, we think it is
also less widely used in practice than, say, `nix path-info`.
Progress on #13570
2025-09-17 16:38:17 -04:00
Robert Hensing
3eb223f4bb
Merge pull request #10915 from NixOS/dummy-memory
...
Use `MemorySourceAccessor` in `DummyStore` so writes work
2025-09-17 22:33:17 +02:00
John Ericson
d5ce8c3caa
Use MemorySourceAccessor in DummyStore
...
Add `read-only` setting to `dummy://` store for back compat.
Test by changing an existing test to use this instead, fixing a TODO.
Co-Authored-By: HaeNoe <git@haenoe.party>
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2025-09-17 16:09:53 -04:00
Eelco Dolstra
7ff61576f2
Merge pull request #14009 from xokdvium/fix-authorization
...
Revert "tests/nixos: Fix daemon store reference in authorization test"
2025-09-17 21:58:44 +02:00
John Ericson
168c24b605
Declare DummyStoreConfig in a header
...
This will useful for unit tests.
2025-09-17 15:54:30 -04:00
John Ericson
613de9d9cc
Add missing #pragma once
2025-09-17 15:21:21 -04:00
Sergei Zimmerman
86ad8d49f9
Revert "tests/nixos: Fix daemon store reference in authorization test"
...
This reverts commit 695f3bc7e3 .
2025-09-17 22:05:26 +03:00