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

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.
This commit is contained in:
John Ericson 2025-02-20 14:15:07 -05:00
parent 326548bae5
commit f3e1c47f47
664 changed files with 2974 additions and 2913 deletions

View file

@ -30,9 +30,9 @@ add_project_arguments(
# It would be nice for our headers to be idempotent instead.
# From C++ libraries, only for internals
'-include', 'config-util.hh',
'-include', 'config-store.hh',
'-include', 'config-expr.hh',
'-include', 'nix/config-util.hh',
'-include', 'nix/config-store.hh',
'-include', 'nix/config-expr.hh',
language : 'cpp',
)
@ -69,7 +69,7 @@ this_library = library(
install : true,
)
install_headers(headers, subdir : 'nix', preserve_path : true)
install_headers(headers, preserve_path : true)
libraries_private = []

View file

@ -2,11 +2,11 @@
#include <stdexcept>
#include <string>
#include "eval.hh"
#include "eval-gc.hh"
#include "globals.hh"
#include "eval-settings.hh"
#include "ref.hh"
#include "nix/eval.hh"
#include "nix/eval-gc.hh"
#include "nix/globals.hh"
#include "nix/eval-settings.hh"
#include "nix/ref.hh"
#include "nix_api_expr.h"
#include "nix_api_expr_internal.h"

View file

@ -1,12 +1,12 @@
#ifndef NIX_API_EXPR_INTERNAL_H
#define NIX_API_EXPR_INTERNAL_H
#include "fetch-settings.hh"
#include "eval.hh"
#include "eval-settings.hh"
#include "attr-set.hh"
#include "nix/fetch-settings.hh"
#include "nix/eval.hh"
#include "nix/eval-settings.hh"
#include "nix/attr-set.hh"
#include "nix_api_value.h"
#include "search-path.hh"
#include "nix/search-path.hh"
struct nix_eval_state_builder
{

View file

@ -1,8 +1,8 @@
#include "attr-set.hh"
#include "config.hh"
#include "eval.hh"
#include "globals.hh"
#include "value.hh"
#include "nix/attr-set.hh"
#include "nix/config.hh"
#include "nix/eval.hh"
#include "nix/globals.hh"
#include "nix/value.hh"
#include "nix_api_expr.h"
#include "nix_api_expr_internal.h"
@ -10,7 +10,7 @@
#include "nix_api_util.h"
#include "nix_api_util_internal.h"
#include "nix_api_value.h"
#include "value/context.hh"
#include "nix/value/context.hh"
#include <nlohmann/json.hpp>

View file

@ -12,9 +12,10 @@
#include "nix_api_expr.h"
#include "nix_api_util.h"
#include "nix_api_value.h"
#include "stdbool.h"
#include "stddef.h"
#include "stdint.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {

View file

@ -1,10 +1,10 @@
#include "attr-set.hh"
#include "config.hh"
#include "eval.hh"
#include "globals.hh"
#include "path.hh"
#include "primops.hh"
#include "value.hh"
#include "nix/attr-set.hh"
#include "nix/config.hh"
#include "nix/eval.hh"
#include "nix/globals.hh"
#include "nix/path.hh"
#include "nix/primops.hh"
#include "nix/value.hh"
#include "nix_api_expr.h"
#include "nix_api_expr_internal.h"
@ -12,7 +12,7 @@
#include "nix_api_util_internal.h"
#include "nix_api_store_internal.h"
#include "nix_api_value.h"
#include "value/context.hh"
#include "nix/value/context.hh"
// Internal helper functions to check [in] and [out] `Value *` parameters
static const nix::Value & check_value_not_null(const nix_value * value)

View file

@ -10,9 +10,10 @@
#include "nix_api_util.h"
#include "nix_api_store.h"
#include "stdbool.h"
#include "stddef.h"
#include "stdint.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {