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

12190 commits

Author SHA1 Message Date
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
Robert Hensing
4de73df8bf
Merge pull request #12765 from Mic92/clan-tidy-cleanups
Add various clang tidy fixes
2025-04-01 15:36:50 +02:00
Robert Hensing
55297f865c Format
clang-format: 18.1.8 -> 19.1.7
2025-04-01 15:33:49 +02:00
Eelco Dolstra
2ec1eba7ca Merge remote-tracking branch 'origin/master' into handle-failed-cached-values 2025-04-01 11:00:27 +02:00
allrealmsoflife
d3ebbb37e8 repl: improve continuation prompt for incomplete expressions
Previously, when users entered an incomplete expression in the REPL,
the continuation prompt was just 10 blank spaces, which looked invisible
and gave the impression that the REPL had stalled.

This change updates the prompt to "         > ", aligning it visually
with 'nix-repl> ' and clearly indicating that the REPL is waiting for
more input.

Fixes: https://github.com/NixOS/nix/issues/12702
2025-04-01 10:25:40 +02:00
John Ericson
c204e307ac Cleanup config headers
There are two big changes:

1. Public and private config is now separated. Configuration variables
   that are only used internally do not go in a header which is
   installed.

   (Additionally, libutil has a unix-specific private config header,
   which should only be used in unix-specific code. This keeps things a
   bit more organized, in a purely private implementation-internal way.)

2. Secondly, there is no more `-include`. There are very few config
   items that need to be publically exposed, so now it is feasible to
   just make the headers that need them just including the (public)
   configuration header.

And there are also a few more small cleanups on top of those:

- The configuration files have better names.

- The few CPP variables that remain exposed in the public headers are
  now also renamed to always start with `NIX_`. This ensures they should
  not conflict with variables defined elsewhere.

- We now always use `#if` and not `#ifdef`/`#ifndef` for our
  configuration variables, which helps avoid bugs by requiring that
  variables must be defined in all cases.
2025-03-31 23:28:36 -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
326548bae5 Cleanup config header for libcmd
- Since it's now private, give it a rename. Note that I want to switch the
  word order on the public ones too.

- Since it is only needed by two files, just include there rather than
  the nasty blanket-forced thing.
2025-03-31 12:20:25 -04:00
Eelco Dolstra
5a35745949 AttrCursor::Parent: shared_ptr -> ref 2025-03-31 15:14:10 +02:00
Eelco Dolstra
8b438fccb4 Throw CachedEvalError if a cached value exists but has type "failed"
Otherwise you get unhelpful errors like

  error: 'apps' is not an attribute set

Fixes #12762.
2025-03-31 15:11:39 +02:00
John Ericson
3f13cc0f87
Merge pull request #12794 from obsidiansystems/fix-windows-build
Fix windows build
2025-03-28 21:04:14 -04:00
John Ericson
99041b4d84 Fix windows build
PR #12767 accidentally broke it.
2025-03-28 20:04:51 -04:00
Eelco Dolstra
9590167290 nix daemon: Don't open the store
This makes it behave the same as nix-daemon. Opening the store in the
parent can cause a SIGBUS in libsqlite in the child:

  #0  0x00007f141cf6f789 in __memset_avx2_unaligned_erms () from /nix/store/wn7v2vhyyyi6clcyn0s9ixvl7d4d87ic-glibc-2.40-36/lib/libc.so.6
  #1  0x00007f141c322fe8 in walIndexAppend () from /nix/store/bbd59cqw259149r2ddk4w1q0lr2fch8c-sqlite-3.46.1/lib/libsqlite3.so.0
  #2  0x00007f141c3711a2 in pagerWalFrames () from /nix/store/bbd59cqw259149r2ddk4w1q0lr2fch8c-sqlite-3.46.1/lib/libsqlite3.so.0
  #3  0x00007f141c38317e in sqlite3PagerCommitPhaseOne.part.0 () from /nix/store/bbd59cqw259149r2ddk4w1q0lr2fch8c-sqlite-3.46.1/lib/libsqlite3.so.0
  #4  0x00007f141c383555 in sqlite3BtreeCommitPhaseOne.part.0 () from /nix/store/bbd59cqw259149r2ddk4w1q0lr2fch8c-sqlite-3.46.1/lib/libsqlite3.so.0
  #5  0x00007f141c384797 in sqlite3VdbeHalt () from /nix/store/bbd59cqw259149r2ddk4w1q0lr2fch8c-sqlite-3.46.1/lib/libsqlite3.so.0
  #6  0x00007f141c3b8f60 in sqlite3VdbeExec () from /nix/store/bbd59cqw259149r2ddk4w1q0lr2fch8c-sqlite-3.46.1/lib/libsqlite3.so.0
  #7  0x00007f141c3bbfef in sqlite3_step () from /nix/store/bbd59cqw259149r2ddk4w1q0lr2fch8c-sqlite-3.46.1/lib/libsqlite3.so.0
  #8  0x00007f141c3bd0e5 in sqlite3_exec () from /nix/store/bbd59cqw259149r2ddk4w1q0lr2fch8c-sqlite-3.46.1/lib/libsqlite3.so.0
  #9  0x00007f141da140e0 in nix::SQLiteTxn::commit() () from /nix/store/1m4r8s7s1v54zq9isncvjgia02bffxlz-determinate-nix-store-3.1.0/lib/libnixstore.so
  #10 0x00007f141d9ce69c in nix::LocalStore::registerValidPaths(std::map<nix::StorePath, nix::ValidPathInfo, std::less<nix::StorePath>, std::allocator<std::pair<nix::StorePath const, nix::ValidPathInfo> > > const&)::{lambda()#1}::operator()() const () from /nix/store/1m4r8s7s1v54zq9isncvjgia02bffxlz-determinate-nix-store-3.1.0/lib/libnixstore.so
2025-03-28 19:29:50 +01:00
John Ericson
fd98f30e4e
Merge pull request #12758 from roberth/lutimes-error
libutil: Fix error message
2025-03-28 13:06:43 -04:00
John Ericson
f1197f7601
Merge pull request #12768 from Mic92/improve-error-messages
substitution-goal: convert assert into an Error
2025-03-28 13:05:46 -04:00
John Ericson
c36a9b8e1b
Merge pull request #12773 from roberth/config-h-low-hanging-fruit
Unexpose config headers (low hanging fruit only)
2025-03-28 12:43:28 -04:00
Robert Hensing
a2e43cd8e6
Merge pull request #12771 from roberth/suppress-parser-warning
nix-expr/parser: Suppress warning
2025-03-28 15:55:05 +00:00
John Ericson
a08b0c742a
Merge pull request #12772 from NixOS/light-packaging-cleanus
Light packaging cleanups
2025-03-28 11:53:48 -04:00
Robert Hensing
1e60ebeea0
Merge pull request #12767 from Mic92/fs-stuff-2
use createDirs consistently everywhere
2025-03-28 15:53:33 +00:00
Robert Hensing
b86a76044e Unexpose config headers (low hanging fruit only)
- Some headers were completely redundant and have been removed.
- Other headers have been turned private.
- Unnecessary meson.build code has been removed.
- libutil-tests now has a private config header, where previously
  it had none. This removes the need to expose a package version
  macro publicly.
2025-03-28 15:17:54 +00:00
John Ericson
e4c571c2f1 Add a withAWS flag to libstore
Nixpkgs wants this, at least.
2025-03-28 11:08:15 -04:00
John Ericson
fb9c9ee35a Link the right issue about the bad AWS pkg-config
It is https://github.com/aws/aws-sdk-cpp/issues/2673
2025-03-28 10:50:46 -04:00
John Ericson
459fb59493 Remove boost env vars
https://github.com/NixOS/nixpkgs/issues/86131 is now fixed!
2025-03-28 10:45:27 -04:00
John Ericson
ffdce51cd5 Fix a bunch of missing meson boilerplate
These other libraries need this too
2025-03-28 10:38:08 -04:00
Robert Hensing
1df69c3920
Merge pull request #12766 from Mic92/fs-stuff
git-utils: add trace context to writeFull
2025-03-28 13:53:29 +00:00
Robert Hensing
aa689b96e6 nix-expr/parser: Suppress warning
We rely on `yyerror()` instead.

> The variable yynerrs contains the number of syntax errors reported so
> far.
> Normally this variable is global; but if you request a pure parser
> (see A Pure (Reentrant) Parser) then it is a local variable which only
> the actions can access.

https://www.gnu.org/software/bison/manual/html_node/Error-Reporting-Function.html
2025-03-28 13:50:24 +00: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
Robert Hensing
0c75581d8b Move call-flake.nix to nix-flake
As suggested by Ericson2314 in review
https://github.com/NixOS/nix/pull/12759#issuecomment-2755352343
2025-03-27 14:29:07 +00:00
Jörg Thalheim
7a6ce75aea substitution-goal: convert assert into an Error
This is to get more context on https://github.com/NixOS/nix/issues/12761
2025-03-27 14:13:57 +01: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
Jörg Thalheim
a8217f2642 use createDirs consistently everywhere 2025-03-27 11:28:11 +01:00
Jörg Thalheim
86de15f4fc git-utils: add trace context to writeFull 2025-03-27 11:26:30 +01:00
Jörg Thalheim
5c3682d7a1 libstore/daemon: make sure monitor is not considered "unused" 2025-03-27 11:24:30 +01:00
Jörg Thalheim
7e540059a3 git/getStringUntil: fix uninitialized stack variable
at least clang-tidy is not convinced that this initialized.
If this is not the case, the impact should be small and hopefully also
more robust if changed.
2025-03-27 11:24:27 +01:00
Jörg Thalheim
05082ea1c5 libstore/local-store: fix linting warning about unused variable 2025-03-27 11:24:25 +01:00
Uluc Sengil
fcf5966488 skip ifds in nix flake show instead of throwing 2025-03-27 11:16:35 +01:00
Robert Hensing
6fc9651d57 nix-expr: remove EvalSettings::addPrimOp, add const
Not required for a struct and potentially confusing.
2025-03-26 19:22:40 +00:00
Robert Hensing
d48101109d nix-flake: Move primops registration to configureEvalSettings 2025-03-26 11:15:02 +00:00
Robert Hensing
6a192ec0cd C API: (breaking) remove nix-flake-c global init 2025-03-26 11:15:02 +00: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
1cffcd91a9 libutil: Fix error message
I encountered this with a misconfigured libutil. I doubt that a
non-lutimes config is viable, because tests were failing.
2025-03-26 09:16:27 +00:00
Robert Hensing
2b4d461c14 checkRefs: use concatMapStringsSep 2025-03-25 06:12:19 +00:00
Robert Hensing
32898dc46a nix-util: Use small_vector in concatMapStringsSep 2025-03-25 06:12:19 +00:00
Robert Hensing
f3dbaa3f54 nix-util: Add concatMapStrings 2025-03-25 06:12:19 +00:00
Sergei Trofimovich
bbdc3197a9 local-derivation-goal: improve "illegal reference" error
Before the change "illegal reference" was hard to interpret as it did
not mention what derivation actually hits it.

Today's `nixpkgs` example:

Before the change:

    $ nix build --no-link -f. postgresql_14
    ...
    error: derivation contains an illegal reference specifier 'man'

After the change:

    $ nix build --no-link -f. postgresql_14
    ...
    error: derivation '/nix/store/bxp6g57limvwiga61vdlyvhy7i8rp6wd-postgresql-14.15.drv' output check for 'lib' contains an illegal reference specifier 'man', expected store path or output name (one of [debug, dev, doc, lib, out])
2025-03-25 06:12:19 +00:00
Las
3cb38e8ab9 Use Goal::waitForAWhile in a few more places 2025-03-24 11:46:55 -04:00
John Ericson
c121daf331 appendLogTailErrorMsg: Take a "smaller" arugment
We just need a `const Store &`, not a `Worker &`.
2025-03-24 11:24:16 -04:00
Jörg Thalheim
87a34a45ff MonitorFdHup::~MonitorFdHup: use proper close method instead of libc close()
Otherwise closing it again will cause an EBADF in the AutoCloseFd class.
2025-03-24 12:09:54 +01:00
John Ericson
ff17dd2a9a
Merge pull request #12730 from xokdvium/repl-shell-env
libcmd/repl: Fix missing runNix in repl
2025-03-23 23:53:26 -04:00