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

1054 commits

Author SHA1 Message Date
Shahar "Dawn" Or
a2784e510f
Merge 88705f848b into f9afc1e68c 2025-06-23 10:10:54 -07:00
Robert Hensing
6a74590063
Merge pull request #13388 from NaN-git/opt-string_view
libexpr: further removal of `std::string` copies
2025-06-23 09:05:28 +02:00
Luc Perkins
d6710b4c04
Merge remote-tracking branch 'upstream/master' into messages-present-tense 2025-06-18 08:24:23 -07:00
Philipp Otterbein
c1aaa970c7 libexpr: further removal of std::string copies 2025-06-15 21:56:45 +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
e4df189123
libexpr: Add and use pathStr getter 2025-06-12 19:57:46 +00:00
Sergei Zimmerman
6587e7bcff
libexpr: Add and use lambda getter 2025-06-12 19:42:50 +00:00
Luc Perkins
ab10fddc6e
Rework future tense in user-facing messages 2025-06-12 09:07:36 -07: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
Philipp Otterbein
afd9c78508 libexpr: fix various overflows and type mismatches 2025-06-02 02:06:48 +02:00
Philipp Otterbein
ed4e512dcd symbol-table: reference entries instead of allocating Values 2025-06-01 21:00:01 +02:00
John Ericson
7577d2d3ae Deprecate hacky way of making structured attrs
The method tested for in the previous commit is now deprecated.

Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2025-05-28 12:59:04 -04:00
gustavderdrache
ce89c8c114 Log warnings on IFD with new option
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2025-05-27 09:18:51 -04:00
Sergei Zimmerman
114de63d88
Fix various typos in source code
This only touches code comments, class names, documentation,
enumeration names and tests.
2025-05-25 20:14:11 +00:00
Sergei Zimmerman
a76c76a9d5
libexpr: Make getAttr a member function of EvalState 2025-05-25 15:52:58 +00:00
Sergei Zimmerman
a4bfd559f1
libexpr: Use attrs.alreadySorted() in primop_functionArgs
Formals are already sorted as it's an invariant of `Formals`.
2025-05-19 19:53:20 +00:00
Eelco Dolstra
efcb9e36a9 Remove global fetcher cache
The cache is now part of fetchers::Settings.
2025-05-17 19:54:32 +02:00
Shahar "Dawn" Or
88705f848b New CLI flag --replace-eval-errors
Co-authored-by: Farid Zakaria <farid.m.zakaria@gmail.com>
2025-05-12 18:44:21 +07:00
Eelco Dolstra
4de7a986d4 Simplify RegisterPrimOp 2025-05-05 08:26:29 +02:00
Sergei Zimmerman
36c583dae0
libexpr: Use C++20 heterogeneous lookup for RegexCache 2025-05-04 16:03:57 +00:00
Philipp Otterbein
56d37656ac libexpr: fix UB in builtins.ceil and builtins.floor
tighten and fix specification of both builtins
2025-04-13 04:36:09 +02:00
John Ericson
cc24766fa6 Expose the nix component in header include paths
For example, instead of doing

    #include "nix/store-config.hh"
    #include "nix/derived-path.hh"

Now do

    #include "nix/store/config.hh"
    #include "nix/store/derived-path.hh"

This was originally planned in the issue, and also recent requested by
Eelco.

Most of the change is purely mechanical. There is just one small
additional issue. See how, in the example above, we took this
opportunity to also turn `<comp>-config.hh` into `<comp>/config.hh`.
Well, there was already a `nix/util/config.{cc,hh}`. Even though there
is not a public configuration header for libutil (which also would be
called `nix/util/config.{cc,hh}`) that's still confusing, To avoid any
such confusion, we renamed that to `nix/util/configuration.{cc,hh}`.

Finally, note that the libflake headers already did this, so we didn't
need to do anything to them. We wouldn't want to mistakenly get
`nix/flake/flake/flake.hh`!

Progress on #7876
2025-04-01 11:40:42 -04:00
John Ericson
f3e1c47f47 Separate headers from source files
The short answer for why we need to do this is so we can consistently do
`#include "nix/..."`. Without this change, there are ways to still make
that work, but they are hacky, and they have downsides such as making it
harder to make sure headers from the wrong Nix library (e..g.
`libnixexpr` headers in `libnixutil`) aren't being used.

The C API alraedy used `nix_api_*`, so its headers are *not* put in
subdirectories accordingly.

Progress on #7876

We resisted doing this for a while because it would be annoying to not
have the header source file pairs close by / easy to change file
path/name from one to the other. But I am ameliorating that with
symlinks in the next commit.
2025-03-31 12:20:25 -04:00
John Ericson
a26a15d05c
Merge pull request #12759 from roberth/c-api-libflake-settings
C API / settings: remove nix-flake-c global init
2025-03-27 12:38:25 -04:00
Jörg Thalheim
ca165f09c0
Merge pull request #12583 from ulucs/ulucs/skip-ifds
`nix flake show`: Skip IFDs instead of throwing
2025-03-27 11:40:49 +01:00
Uluc Sengil
fcf5966488 skip ifds in nix flake show instead of throwing 2025-03-27 11:16:35 +01:00
Sizhe Zhao
39ce478283
docs: document unsafeGetAttrPos 2025-03-26 18:48:57 +08:00
Robert Hensing
3c4c0953e0 nix-expr: Add primops to EvalSettings 2025-03-26 09:32:43 +00:00
Robert Hensing
efbd4c1ebb
Merge pull request #12442 from NixOS/store-derivation-options
Expand manual on derivation outputs
2025-03-03 23:11:51 +01:00
John Ericson
2aa6e0f084 Expand manual on derivation outputs
Note, this includes some text adapted from from Eelco's dissertation
2025-02-27 02:13:36 -05:00
Sergei Zimmerman
af2ddfdb3b libexpr: Fix use-after-free of StaticEnv::up
It's not very clear what the ownership model is here, but one thing
is certain: `.up` can't be destroyed before the StaticEnv that refers
to it is.

Changing a non-owning pointer to taking shared ownership of the parent
`StaticEnv` prevents the `.up` from being freed.

I'm not a huge fan of the inverted ownership, where child `StaticEnv`
takes a refcount of the parent, but this seems like the least intrusive
way to fix the use-after-free.

This shouldn't cause any shared_ptr cycles to appear (hopefully).
2025-02-21 14:36:39 +00:00
Eelco Dolstra
ec7dc56f4e Remove unused variable 2025-02-20 01:09:18 +01:00
Eelco Dolstra
99e78c37f7 Use UnionSourceAccessor to mount the chroot store on top of the real store directory 2025-02-19 12:54:09 +01:00
Eelco Dolstra
774b924398 Add a storeFS accessor for paths resulting from IFD
Hopefully fixes #11503.
2025-02-19 12:47:28 +01:00
John Ericson
e80d333777
Document Store Derivations and Deriving Paths (#12290)
This is a big step documenting the store layer on its own, separately from the evaluator (and `builtins.derivation`).

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2025-02-10 01:30:07 +00:00
Robert Hensing
7465fbe926 refactor: Extract EvalState::realiseString 2025-01-27 12:32:46 +01:00
Philipp Otterbein
1e2cace5f1 fix documentation of substring 2024-12-28 23:40:25 +01:00
Parker Jones
cf69c99f3e
Make readFileType doc string consistent
The primitive `readFileType p` has a list of acceptable types, and so does `readDir path`

This edit makes the formatting of the list consistent between themselves, and other parts of the documentation.
2024-12-27 01:11:36 -05:00
Eelco Dolstra
08361f031d EvalState::realiseContext(): Allow access to the entire closure
Fixes #11030.
2024-12-16 16:16:36 +01:00
Eelco Dolstra
8490fba42d Improve error messages for head/elemAt 2024-12-09 16:15:23 +01:00
‮rekcäH nitraM‮
49fa31fb4c
Fix typo (#12015) 2024-12-05 19:10:59 +00:00
Sergei Zimmerman
fafaec5ac3 fix(treewide): remove unnecessary copying in range for loops
This gets rid of unnecessary copies in range-based-for loops and
local variables, when they are used solely as `const &`.

Also added a fixme comment about a suspicious move out of const,
which might not be intended.
2024-11-26 00:06:29 +03:00
Sergei Zimmerman
756758d968 chore: get rid of dead code and unused variables where appropriate
Looks like some cruft has been left over from previous refactorings.
This removes dead variables, which should not have side effects in their
constructors. In cases where the variable initialization has a purpose
[[maybe_unused]] is inserted to silence compiler warnings.
2024-11-22 18:05:53 +03:00
Eelco Dolstra
ad7ad017ea EvalState::callPathFilter(): Remove unnecessary pathArg argument 2024-11-20 16:35:47 +01:00
Robert Hensing
32becc87fe
Merge pull request #11914 from roberth/evalstate-get-builtins
EvalState::getBuiltins
2024-11-19 19:33:37 +01:00
Robert Hensing
5c258d7e25 refactor: Use EvalState::getBuiltins() 2024-11-19 18:45:53 +01:00
Eelco Dolstra
f1b4f14055 Trivial changes from lazy-trees 2024-11-19 17:30:38 +01:00
Eelco Dolstra
a2e4a4c238 callFunction: Use std::span
This is a bit safer than having a separate nrArgs argument.
2024-11-12 19:26:39 +01:00
Sergei Zimmerman
0fe3b54ee1 refactor(treewide): reserve vector capacity when final size is known
In these trivial cases the final vector size (or lower bound on the size) is known,
so we can avoid some vector reallocations. This is not very important, but is just
good practice and general hygiene.
2024-11-09 22:40:49 +03:00