1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00
Commit graph

12182 commits

Author SHA1 Message Date
Eelco Dolstra
20ba6be749 Improve the Rosetta installation hint
The Nix daemon detects supported system types at start time, so it
needs to be restarted to detect x86_64-darwin support.
2025-06-19 13:58:51 +02:00
John Ericson
d254c840b5
Merge pull request #13349 from obsidiansystems/structured-attrs-json
Introduce top-level `structuredAttrs` field in JSON derivation format
2025-06-18 16:35:42 -04:00
Wolfgang Walther
d64c922164
libstore: fix race condition when creating state directories
Running parallel nix in nix can lead to multiple instances trying to
create the state directories and failing on the `createSymlink` step,
because the link already exists.

`replaceSymlink` is already idempotent, so let's use that.

Resolves #2706
2025-06-17 08:45:29 +02:00
Sergei Zimmerman
ddcfc81ff1
libexpr: Document requirements for comparator passed to builtins.sort 2025-06-15 16:52:05 +00:00
Sergei Zimmerman
351d898c43
libexpr: Switch builtins.sort primop to use peeksort
This prevents C++ level undefined behavior from affecting
the evaluator. Stdlib implementation details should not affect
eval, regardless of the build platform. Even erroneous usage
of `builtins.sort` should not make it possible to crash the
evaluator or produce results that depend on the host platform.
2025-06-15 16:52:03 +00:00
Sergei Zimmerman
b2596a7615
libutil: Add custom PeekSort implementation
Unlike std::sort and std::stable_sort, this implementation
does not lead to out-of-bounds memory reads or other undefined
behavior when the predicate is not strict weak ordering.

This makes it possible to use this function in libexpr for
builtins.sort, where an incorrectly implemented comparator
in the user nix code currently can crash and burn the evaluator
by invoking C++ UB.
2025-06-15 16:52:01 +00:00
Jörg Thalheim
a1fe09d2c8
Merge pull request #13350 from xokdvium/meson-format
flake: Add meson formatter
2025-06-13 11:37:32 +02:00
John Ericson
f8c1ac9515 Introduce top-level structuredAttrs field in JSON derivation format
Makes the behavoral change of #13263 without the underlying refactor.
Hopefully this clearly safe from a perf and GC perspective, and will
make it easier to benchmark #13263.
2025-06-12 20:45:47 -04:00
Sergei Zimmerman
7b46eb9958
libexpr: Remove non-const overload of listElems
This overload isn't actually necessary anywhere and
doesn't make much sense. The pointers to `Value`s are
themselves const, but the `Value`s are mutable.
A non-const member function implies that the object itself
can be modified but this doesn't make much sense considering
the return type: `Value * const * `, which is a pointer
to a constant array of pointers to mutable values.
2025-06-12 22:29:05 +00:00
Sergei Zimmerman
bc6b52aff0
libexpr: Add and use pathAccessor getter 2025-06-12 20:01:38 +00:00
Sergei Zimmerman
e4df189123
libexpr: Add and use pathStr getter 2025-06-12 19:57:46 +00:00
Sergei Zimmerman
c041d71406
libexpr: Add and use app getter 2025-06-12 19:53:44 +00:00
Sergei Zimmerman
f07a9f863e
libexpr: Add and use primOpApp getter 2025-06-12 19:51:44 +00:00
Sergei Zimmerman
441fa86e82
libexpr: Add and use thunk getter 2025-06-12 19:48:42 +00:00
Sergei Zimmerman
6587e7bcff
libexpr: Add and use lambda getter 2025-06-12 19:42:50 +00:00
Sergei Zimmerman
93a42a5971
flake: Add meson formatter
This adds a meson.format file that mostly mirrors the projects
meson style and a pre-commit hook to enforce this style.
Some low-diff files are formatted.
2025-06-11 22:08:03 +00:00
John Ericson
371fcf91c3
Merge pull request #13294 from obsidiansystems/fix-13293
Fix #13293
2025-06-11 16:55:43 -04:00
John Ericson
5267718472 Fix #13293
We move the `assertPathValidity` to where we know what the wanted
outputs are.
2025-06-11 16:15:26 -04:00
Luc Perkins
525078c59d
Fix broken link in configuration description 2025-06-11 08:52:04 -07:00
Sergei Zimmerman
408873c2f7
libexpr: Use c_str getter 2025-06-10 13:37:06 +00:00
Sergei Zimmerman
77f5f50ec2
libexpr: Use context getter 2025-06-10 13:37:04 +00:00
Sergei Zimmerman
c2aaa68c2c
libexpr: Use primOp getter 2025-06-10 13:37:01 +00:00
Robert Hensing
c5b1be46b4
Merge pull request #11406 from kstrafe/master
nix repl: Print which variables are just loaded
2025-06-07 13:53:13 +02:00
Robert Hensing
102259898c
Merge pull request #13258 from NaN-git/opt-symbol-table
Optimize symbol table
2025-06-07 13:16:14 +02:00
Eelco Dolstra
91b3573770 Rethrow non-EOF errors 2025-06-06 17:09:01 +02:00
Eelco Dolstra
d8b067b549 repl: Don't wait on incomplete parses from imported file
Fixes #13332.
2025-06-06 14:14:57 +02:00
Jörg Thalheim
37b4407c5c
Merge pull request #13284 from getchoo-contrib/getchoo/override-input-local-registry
lockFlake(): Allow registry lookups for overridden inputs
2025-06-06 10:11:27 +02:00
Kevin Robert Stravers
13e3704329
nix repl: Add :ll to show all recently loaded variables
Invoking `:ll` will start a pager with all variables which have just
been loaded by `:lf`, `:l`, or by a flake provided to `nix repl` as an
argument.

https://github.com/NixOS/nix/issues/11404
2025-06-05 17:33:04 -04:00
Kevin Robert Stravers
3c9b9b13af
nix repl: Print which variables are just loaded
When we run `nix repl nixpkgs` we get "Added 6 variables". This is not
useful as it doesn't tell us which variables the flake has exported to
our global repl scope.

This patch prints the name of each variable that was just loaded. We
currently cap printing to 20 variables in order to avoid excessive
prints.

https://github.com/NixOS/nix/issues/11404
2025-06-05 17:32:57 -04:00
Eelco Dolstra
4bce2d723d GitSourceAccessor: Make thread-safe 2025-06-04 21:39:15 +02:00
Jörg Thalheim
4b8f74b3a3
Merge pull request #13320 from DeterminateSystems/keep-failed-remote-builders-warning
Clarify that `--keep-failed` with remote builders will keep the failed build directory on that builder
2025-06-03 19:28:20 +02:00
Cole Helbling
54aa73b19b
fixup: only show "you can rerun" message if the derivation's platform is supported on this machine 2025-06-03 08:38:50 -07:00
Cole Helbling
0712339912
--keep-failed with remote builders will keep the failed build directory on that builder 2025-06-03 07:50:29 -07:00
Jörg Thalheim
6a761c1a60
Merge pull request #13296 from xokdvium/empty-accessor-prefix
Clear `displayPrefix` in `makeEmptySourceAccessor`
2025-06-03 01:32:46 +02:00
Jörg Thalheim
e72f19eb28
Merge pull request #13300 from NixOS/deletePath-keep-going
deletePath(): Keep going when encountering an undeletable file
2025-06-02 18:00:10 +02:00
Eelco Dolstra
6b6d3dcf34 deletePath(): Keep going when encountering an undeletable file
This should reduce the impact of #5207.
2025-06-02 14:54:01 +02:00
Eelco Dolstra
86767349d5
Merge pull request #13304 from fzakaria/small-fix
Fix overriding gtest with gmock
2025-06-02 14:02:47 +02:00
Eelco Dolstra
7ad4426b8b
Merge pull request #13310 from xokdvium/cleanup-position
libutil: Use `std::shared_ptr<const Pos>` and simplify `Pos` class constructors
2025-06-02 14:02:25 +02:00
Eelco Dolstra
97e3c3fff8
Merge pull request #13309 from NaN-git/fix-substring
libexpr: fix various overflows and type mismatches
2025-06-02 14:01:48 +02:00
Philipp Otterbein
afd9c78508 libexpr: fix various overflows and type mismatches 2025-06-02 02:06:48 +02:00
Sergei Zimmerman
9563b509ff
libexpr: Deduplicate Value::primOpAppPrimOp
`getPrimOp` function was basically identical to existing
`Value::primOpAppPrimOp` modulo some trivial differences.
Makes sense to reuse existing code for that.
2025-06-01 21:16:01 +00:00
Sergei Zimmerman
cdb8567473
libutil: Don't explicitly default special member functions
Since all of the member types are copyable/movable the compiler
will generate all of those by default anyway.
2025-06-01 20:55:28 +00:00
Sergei Zimmerman
b73e706589
libutil: Use std::shared_ptr<const Pos> instead of std::shared_ptr<Pos>
There's actually no mutation happening so there's no point in using
a mutable shared_ptr. Furthermore, this makes it much more evident to
the reader that no actual mutation (especially in multithreaded case)
is happening.

Also get rid of redundant constructor that isn't actually used anywhere
other than `Pos::operator std::shared_ptr<Pos>` which just passes in &*this,
(identical to just `this`), which can't be nullptr.
2025-06-01 20:55:26 +00:00
Philipp Otterbein
ed4e512dcd symbol-table: reference entries instead of allocating Values 2025-06-01 21:00:01 +02:00
Philipp Otterbein
94bbaddb93 symbol-table: reduce memory usage and use boost::unordered_flat_set 2025-06-01 19:20:11 +02:00
Farid Zakaria
58e34a2d27 Overriding gtest with gmock
How did this work before...

* Added .direnv/ to gitignore
2025-05-31 07:41:27 -07:00
Eelco Dolstra
908129eb22 Cleanup 2025-05-30 11:54:54 +02:00
Eelco Dolstra
4dc419eaec Split LinuxDerivationBuilder
This restores doing seccomp/personality initialization even when
sandboxing is disabled.

https://hydra.nixos.org/build/298482132
2025-05-29 21:57:25 +02:00
Eelco Dolstra
b7fd872147 Cleanup 2025-05-29 21:39:22 +02:00
Sergei Zimmerman
fba1bb0c13
Clear displayPrefix in makeEmptySourceAccessor
Judging by the comment for `makeEmptySourceAccessor` the prefix has
to be empty:

> Return a source accessor that contains only an empty root directory.

Fixes #13295.
2025-05-29 19:35:12 +00:00