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

Merge remote-tracking branch 'origin/master' into handle-failed-cached-values

This commit is contained in:
Eelco Dolstra 2025-04-01 11:00:27 +02:00
commit 2ec1eba7ca
669 changed files with 3341 additions and 3231 deletions

View file

@ -128,3 +128,14 @@ pull_request_rules:
labels: labels:
- automatic backport - automatic backport
- merge-queue - merge-queue
- name: backport patches to 2.28
conditions:
- label=backport 2.28-maintenance
actions:
backport:
branches:
- "2.28-maintenance"
labels:
- automatic backport
- merge-queue

View file

@ -31,7 +31,7 @@ The unit tests are defined using the [googletest] and [rapidcheck] frameworks.
> ├── libexpr > ├── libexpr
> │ ├── meson.build > │ ├── meson.build
> │ ├── value/context.hh > │ ├── value/context.hh
> │ ├── value/context.cc > │ ├── include/nix/value/context.cc
> │ … > │ …
> │ > │
> ├── tests > ├── tests
@ -46,8 +46,12 @@ The unit tests are defined using the [googletest] and [rapidcheck] frameworks.
> │ │ > │ │
> │ ├── libexpr-test-support > │ ├── libexpr-test-support
> │ │ ├── meson.build > │ │ ├── meson.build
> │ │ ├── include/nix
> │ │ │ ├── meson.build
> │ │ │ └── tests
> │ │ │ ├── value/context.hh
> │ │ │ …
> │ │ └── tests > │ │ └── tests
> │ │ ├── value/context.hh
> │ │ ├── value/context.cc > │ │ ├── value/context.cc
> │ │ … > │ │ …
> │ │ > │ │
@ -59,7 +63,7 @@ The unit tests are defined using the [googletest] and [rapidcheck] frameworks.
> ``` > ```
The tests for each Nix library (`libnixexpr`, `libnixstore`, etc..) live inside a directory `src/${library_name_without-nix}-test`. The tests for each Nix library (`libnixexpr`, `libnixstore`, etc..) live inside a directory `src/${library_name_without-nix}-test`.
Given an interface (header) and implementation pair in the original library, say, `src/libexpr/value/context.{hh,cc}`, we write tests for it in `src/libexpr-tests/value/context.cc`, and (possibly) declare/define additional interfaces for testing purposes in `src/libexpr-test-support/tests/value/context.{hh,cc}`. Given an interface (header) and implementation pair in the original library, say, `src/libexpr/include/nix/value/context.hh` and `src/libexpr/value/context.cc`, we write tests for it in `src/libexpr-tests/value/context.cc`, and (possibly) declare/define additional interfaces for testing purposes in `src/libexpr-test-support/include/nix/tests/value/context.hh` and `src/libexpr-test-support/tests/value/context.cc`.
Data for unit tests is stored in a `data` subdir of the directory for each unit test executable. Data for unit tests is stored in a `data` subdir of the directory for each unit test executable.
For example, `libnixstore` code is in `src/libstore`, and its test data is in `src/libstore-tests/data`. For example, `libnixstore` code is in `src/libstore`, and its test data is in `src/libstore-tests/data`.
@ -67,7 +71,7 @@ The path to the `src/${library_name_without-nix}-test/data` directory is passed
Note that each executable only gets the data for its tests. Note that each executable only gets the data for its tests.
The unit test libraries are in `src/${library_name_without-nix}-test-support`. The unit test libraries are in `src/${library_name_without-nix}-test-support`.
All headers are in a `tests` subdirectory so they are included with `#include "tests/"`. All headers are in a `tests` subdirectory so they are included with `#include "nix/tests/"`.
The use of all these separate directories for the unit tests might seem inconvenient, as for example the tests are not "right next to" the part of the code they are testing. The use of all these separate directories for the unit tests might seem inconvenient, as for example the tests are not "right next to" the part of the code they are testing.
But organizing the tests this way has one big benefit: But organizing the tests this way has one big benefit:

View file

@ -230,24 +230,28 @@
This shouldn't build anything significant; just check that things This shouldn't build anything significant; just check that things
(including derivations) are _set up_ correctly. (including derivations) are _set up_ correctly.
*/ */
packaging-overriding = # Disabled due to a bug in `testEqualContents` (see
let # https://github.com/NixOS/nix/issues/12690).
pkgs = nixpkgsFor.${system}.native; /*
nix = self.packages.${system}.nix; packaging-overriding =
in let
assert (nix.appendPatches [ pkgs.emptyFile ]).libs.nix-util.src.patches == [ pkgs.emptyFile ]; pkgs = nixpkgsFor.${system}.native;
if pkgs.stdenv.buildPlatform.isDarwin then nix = self.packages.${system}.nix;
lib.warn "packaging-overriding check currently disabled because of a permissions issue on macOS" pkgs.emptyFile in
else assert (nix.appendPatches [ pkgs.emptyFile ]).libs.nix-util.src.patches == [ pkgs.emptyFile ];
# If this fails, something might be wrong with how we've wired the scope, if pkgs.stdenv.buildPlatform.isDarwin then
# or something could be broken in Nixpkgs. lib.warn "packaging-overriding check currently disabled because of a permissions issue on macOS" pkgs.emptyFile
pkgs.testers.testEqualContents { else
assertion = "trivial patch does not change source contents"; # If this fails, something might be wrong with how we've wired the scope,
expected = "${./.}"; # or something could be broken in Nixpkgs.
actual = pkgs.testers.testEqualContents {
# Same for all components; nix-util is an arbitrary pick assertion = "trivial patch does not change source contents";
(nix.appendPatches [ pkgs.emptyFile ]).libs.nix-util.src; expected = "${./.}";
}; actual =
# Same for all components; nix-util is an arbitrary pick
(nix.appendPatches [ pkgs.emptyFile ]).libs.nix-util.src;
};
*/
} }
// (lib.optionalAttrs (builtins.elem system linux64BitSystems)) { // (lib.optionalAttrs (builtins.elem system linux64BitSystems)) {
dockerImage = self.hydraJobs.dockerImage.${system}; dockerImage = self.hydraJobs.dockerImage.${system};

View file

@ -84,340 +84,340 @@
''^precompiled-headers\.h$'' ''^precompiled-headers\.h$''
''^src/build-remote/build-remote\.cc$'' ''^src/build-remote/build-remote\.cc$''
''^src/libcmd/built-path\.cc$'' ''^src/libcmd/built-path\.cc$''
''^src/libcmd/built-path\.hh$'' ''^src/libcmd/include/nix/built-path\.hh$''
''^src/libcmd/common-eval-args\.cc$'' ''^src/libcmd/common-eval-args\.cc$''
''^src/libcmd/common-eval-args\.hh$'' ''^src/libcmd/include/nix/common-eval-args\.hh$''
''^src/libcmd/editor-for\.cc$'' ''^src/libcmd/editor-for\.cc$''
''^src/libcmd/installable-attr-path\.cc$'' ''^src/libcmd/installable-attr-path\.cc$''
''^src/libcmd/installable-attr-path\.hh$'' ''^src/libcmd/include/nix/installable-attr-path\.hh$''
''^src/libcmd/installable-derived-path\.cc$'' ''^src/libcmd/installable-derived-path\.cc$''
''^src/libcmd/installable-derived-path\.hh$'' ''^src/libcmd/include/nix/installable-derived-path\.hh$''
''^src/libcmd/installable-flake\.cc$'' ''^src/libcmd/installable-flake\.cc$''
''^src/libcmd/installable-flake\.hh$'' ''^src/libcmd/include/nix/installable-flake\.hh$''
''^src/libcmd/installable-value\.cc$'' ''^src/libcmd/installable-value\.cc$''
''^src/libcmd/installable-value\.hh$'' ''^src/libcmd/include/nix/installable-value\.hh$''
''^src/libcmd/installables\.cc$'' ''^src/libcmd/installables\.cc$''
''^src/libcmd/installables\.hh$'' ''^src/libcmd/include/nix/installables\.hh$''
''^src/libcmd/legacy\.hh$'' ''^src/libcmd/include/nix/legacy\.hh$''
''^src/libcmd/markdown\.cc$'' ''^src/libcmd/markdown\.cc$''
''^src/libcmd/misc-store-flags\.cc$'' ''^src/libcmd/misc-store-flags\.cc$''
''^src/libcmd/repl-interacter\.cc$'' ''^src/libcmd/repl-interacter\.cc$''
''^src/libcmd/repl-interacter\.hh$'' ''^src/libcmd/include/nix/repl-interacter\.hh$''
''^src/libcmd/repl\.cc$'' ''^src/libcmd/repl\.cc$''
''^src/libcmd/repl\.hh$'' ''^src/libcmd/include/nix/repl\.hh$''
''^src/libexpr-c/nix_api_expr\.cc$'' ''^src/libexpr-c/nix_api_expr\.cc$''
''^src/libexpr-c/nix_api_external\.cc$'' ''^src/libexpr-c/nix_api_external\.cc$''
''^src/libexpr/attr-path\.cc$'' ''^src/libexpr/attr-path\.cc$''
''^src/libexpr/attr-path\.hh$'' ''^src/libexpr/include/nix/attr-path\.hh$''
''^src/libexpr/attr-set\.cc$'' ''^src/libexpr/attr-set\.cc$''
''^src/libexpr/attr-set\.hh$'' ''^src/libexpr/include/nix/attr-set\.hh$''
''^src/libexpr/eval-cache\.cc$'' ''^src/libexpr/eval-cache\.cc$''
''^src/libexpr/eval-cache\.hh$'' ''^src/libexpr/include/nix/eval-cache\.hh$''
''^src/libexpr/eval-error\.cc$'' ''^src/libexpr/eval-error\.cc$''
''^src/libexpr/eval-inline\.hh$'' ''^src/libexpr/include/nix/eval-inline\.hh$''
''^src/libexpr/eval-settings\.cc$'' ''^src/libexpr/eval-settings\.cc$''
''^src/libexpr/eval-settings\.hh$'' ''^src/libexpr/include/nix/eval-settings\.hh$''
''^src/libexpr/eval\.cc$'' ''^src/libexpr/eval\.cc$''
''^src/libexpr/eval\.hh$'' ''^src/libexpr/include/nix/eval\.hh$''
''^src/libexpr/function-trace\.cc$'' ''^src/libexpr/function-trace\.cc$''
''^src/libexpr/gc-small-vector\.hh$'' ''^src/libexpr/include/nix/gc-small-vector\.hh$''
''^src/libexpr/get-drvs\.cc$'' ''^src/libexpr/get-drvs\.cc$''
''^src/libexpr/get-drvs\.hh$'' ''^src/libexpr/include/nix/get-drvs\.hh$''
''^src/libexpr/json-to-value\.cc$'' ''^src/libexpr/json-to-value\.cc$''
''^src/libexpr/nixexpr\.cc$'' ''^src/libexpr/nixexpr\.cc$''
''^src/libexpr/nixexpr\.hh$'' ''^src/libexpr/include/nix/nixexpr\.hh$''
''^src/libexpr/parser-state\.hh$'' ''^src/libexpr/include/nix/parser-state\.hh$''
''^src/libexpr/primops\.cc$'' ''^src/libexpr/primops\.cc$''
''^src/libexpr/primops\.hh$'' ''^src/libexpr/include/nix/primops\.hh$''
''^src/libexpr/primops/context\.cc$'' ''^src/libexpr/primops/context\.cc$''
''^src/libexpr/primops/fetchClosure\.cc$'' ''^src/libexpr/primops/fetchClosure\.cc$''
''^src/libexpr/primops/fetchMercurial\.cc$'' ''^src/libexpr/primops/fetchMercurial\.cc$''
''^src/libexpr/primops/fetchTree\.cc$'' ''^src/libexpr/primops/fetchTree\.cc$''
''^src/libexpr/primops/fromTOML\.cc$'' ''^src/libexpr/primops/fromTOML\.cc$''
''^src/libexpr/print-ambiguous\.cc$'' ''^src/libexpr/print-ambiguous\.cc$''
''^src/libexpr/print-ambiguous\.hh$'' ''^src/libexpr/include/nix/print-ambiguous\.hh$''
''^src/libexpr/print-options\.hh$'' ''^src/libexpr/include/nix/print-options\.hh$''
''^src/libexpr/print\.cc$'' ''^src/libexpr/print\.cc$''
''^src/libexpr/print\.hh$'' ''^src/libexpr/include/nix/print\.hh$''
''^src/libexpr/search-path\.cc$'' ''^src/libexpr/search-path\.cc$''
''^src/libexpr/symbol-table\.hh$'' ''^src/libexpr/include/nix/symbol-table\.hh$''
''^src/libexpr/value-to-json\.cc$'' ''^src/libexpr/value-to-json\.cc$''
''^src/libexpr/value-to-json\.hh$'' ''^src/libexpr/include/nix/value-to-json\.hh$''
''^src/libexpr/value-to-xml\.cc$'' ''^src/libexpr/value-to-xml\.cc$''
''^src/libexpr/value-to-xml\.hh$'' ''^src/libexpr/include/nix/value-to-xml\.hh$''
''^src/libexpr/value\.hh$'' ''^src/libexpr/include/nix/value\.hh$''
''^src/libexpr/value/context\.cc$'' ''^src/libexpr/value/context\.cc$''
''^src/libexpr/value/context\.hh$'' ''^src/libexpr/include/nix/value/context\.hh$''
''^src/libfetchers/attrs\.cc$'' ''^src/libfetchers/attrs\.cc$''
''^src/libfetchers/cache\.cc$'' ''^src/libfetchers/cache\.cc$''
''^src/libfetchers/cache\.hh$'' ''^src/libfetchers/include/nix/cache\.hh$''
''^src/libfetchers/fetch-settings\.cc$'' ''^src/libfetchers/fetch-settings\.cc$''
''^src/libfetchers/fetch-settings\.hh$'' ''^src/libfetchers/include/nix/fetch-settings\.hh$''
''^src/libfetchers/fetch-to-store\.cc$'' ''^src/libfetchers/fetch-to-store\.cc$''
''^src/libfetchers/fetchers\.cc$'' ''^src/libfetchers/fetchers\.cc$''
''^src/libfetchers/fetchers\.hh$'' ''^src/libfetchers/include/nix/fetchers\.hh$''
''^src/libfetchers/filtering-source-accessor\.cc$'' ''^src/libfetchers/filtering-source-accessor\.cc$''
''^src/libfetchers/filtering-source-accessor\.hh$'' ''^src/libfetchers/include/nix/filtering-source-accessor\.hh$''
''^src/libfetchers/fs-source-accessor\.cc$'' ''^src/libfetchers/fs-source-accessor\.cc$''
''^src/libfetchers/fs-source-accessor\.hh$'' ''^src/libfetchers/include/nix/fs-source-accessor\.hh$''
''^src/libfetchers/git-utils\.cc$'' ''^src/libfetchers/git-utils\.cc$''
''^src/libfetchers/git-utils\.hh$'' ''^src/libfetchers/include/nix/git-utils\.hh$''
''^src/libfetchers/github\.cc$'' ''^src/libfetchers/github\.cc$''
''^src/libfetchers/indirect\.cc$'' ''^src/libfetchers/indirect\.cc$''
''^src/libfetchers/memory-source-accessor\.cc$'' ''^src/libfetchers/memory-source-accessor\.cc$''
''^src/libfetchers/path\.cc$'' ''^src/libfetchers/path\.cc$''
''^src/libfetchers/registry\.cc$'' ''^src/libfetchers/registry\.cc$''
''^src/libfetchers/registry\.hh$'' ''^src/libfetchers/include/nix/registry\.hh$''
''^src/libfetchers/tarball\.cc$'' ''^src/libfetchers/tarball\.cc$''
''^src/libfetchers/tarball\.hh$'' ''^src/libfetchers/include/nix/tarball\.hh$''
''^src/libfetchers/git\.cc$'' ''^src/libfetchers/git\.cc$''
''^src/libfetchers/mercurial\.cc$'' ''^src/libfetchers/mercurial\.cc$''
''^src/libflake/flake/config\.cc$'' ''^src/libflake/flake/config\.cc$''
''^src/libflake/flake/flake\.cc$'' ''^src/libflake/flake/flake\.cc$''
''^src/libflake/flake/flake\.hh$'' ''^src/libflake/include/nix/flake/flake\.hh$''
''^src/libflake/flake/flakeref\.cc$'' ''^src/libflake/flake/flakeref\.cc$''
''^src/libflake/flake/flakeref\.hh$'' ''^src/libflake/include/nix/flake/flakeref\.hh$''
''^src/libflake/flake/lockfile\.cc$'' ''^src/libflake/flake/lockfile\.cc$''
''^src/libflake/flake/lockfile\.hh$'' ''^src/libflake/include/nix/flake/lockfile\.hh$''
''^src/libflake/flake/url-name\.cc$'' ''^src/libflake/flake/url-name\.cc$''
''^src/libmain/common-args\.cc$'' ''^src/libmain/common-args\.cc$''
''^src/libmain/common-args\.hh$'' ''^src/libmain/include/nix/common-args\.hh$''
''^src/libmain/loggers\.cc$'' ''^src/libmain/loggers\.cc$''
''^src/libmain/loggers\.hh$'' ''^src/libmain/include/nix/loggers\.hh$''
''^src/libmain/progress-bar\.cc$'' ''^src/libmain/progress-bar\.cc$''
''^src/libmain/shared\.cc$'' ''^src/libmain/shared\.cc$''
''^src/libmain/shared\.hh$'' ''^src/libmain/include/nix/shared\.hh$''
''^src/libmain/unix/stack\.cc$'' ''^src/libmain/unix/stack\.cc$''
''^src/libstore/binary-cache-store\.cc$'' ''^src/libstore/binary-cache-store\.cc$''
''^src/libstore/binary-cache-store\.hh$'' ''^src/libstore/include/nix/binary-cache-store\.hh$''
''^src/libstore/build-result\.hh$'' ''^src/libstore/include/nix/build-result\.hh$''
''^src/libstore/builtins\.hh$'' ''^src/libstore/include/nix/builtins\.hh$''
''^src/libstore/builtins/buildenv\.cc$'' ''^src/libstore/builtins/buildenv\.cc$''
''^src/libstore/builtins/buildenv\.hh$'' ''^src/libstore/include/nix/builtins/buildenv\.hh$''
''^src/libstore/common-protocol-impl\.hh$'' ''^src/libstore/include/nix/common-protocol-impl\.hh$''
''^src/libstore/common-protocol\.cc$'' ''^src/libstore/common-protocol\.cc$''
''^src/libstore/common-protocol\.hh$'' ''^src/libstore/include/nix/common-protocol\.hh$''
''^src/libstore/common-ssh-store-config\.hh$'' ''^src/libstore/include/nix/common-ssh-store-config\.hh$''
''^src/libstore/content-address\.cc$'' ''^src/libstore/content-address\.cc$''
''^src/libstore/content-address\.hh$'' ''^src/libstore/include/nix/content-address\.hh$''
''^src/libstore/daemon\.cc$'' ''^src/libstore/daemon\.cc$''
''^src/libstore/daemon\.hh$'' ''^src/libstore/include/nix/daemon\.hh$''
''^src/libstore/derivations\.cc$'' ''^src/libstore/derivations\.cc$''
''^src/libstore/derivations\.hh$'' ''^src/libstore/include/nix/derivations\.hh$''
''^src/libstore/derived-path-map\.cc$'' ''^src/libstore/derived-path-map\.cc$''
''^src/libstore/derived-path-map\.hh$'' ''^src/libstore/include/nix/derived-path-map\.hh$''
''^src/libstore/derived-path\.cc$'' ''^src/libstore/derived-path\.cc$''
''^src/libstore/derived-path\.hh$'' ''^src/libstore/include/nix/derived-path\.hh$''
''^src/libstore/downstream-placeholder\.cc$'' ''^src/libstore/downstream-placeholder\.cc$''
''^src/libstore/downstream-placeholder\.hh$'' ''^src/libstore/include/nix/downstream-placeholder\.hh$''
''^src/libstore/dummy-store\.cc$'' ''^src/libstore/dummy-store\.cc$''
''^src/libstore/export-import\.cc$'' ''^src/libstore/export-import\.cc$''
''^src/libstore/filetransfer\.cc$'' ''^src/libstore/filetransfer\.cc$''
''^src/libstore/filetransfer\.hh$'' ''^src/libstore/include/nix/filetransfer\.hh$''
''^src/libstore/gc-store\.hh$'' ''^src/libstore/include/nix/gc-store\.hh$''
''^src/libstore/globals\.cc$'' ''^src/libstore/globals\.cc$''
''^src/libstore/globals\.hh$'' ''^src/libstore/include/nix/globals\.hh$''
''^src/libstore/http-binary-cache-store\.cc$'' ''^src/libstore/http-binary-cache-store\.cc$''
''^src/libstore/legacy-ssh-store\.cc$'' ''^src/libstore/legacy-ssh-store\.cc$''
''^src/libstore/legacy-ssh-store\.hh$'' ''^src/libstore/include/nix/legacy-ssh-store\.hh$''
''^src/libstore/length-prefixed-protocol-helper\.hh$'' ''^src/libstore/include/nix/length-prefixed-protocol-helper\.hh$''
''^src/libstore/linux/personality\.cc$'' ''^src/libstore/linux/personality\.cc$''
''^src/libstore/linux/personality\.hh$'' ''^src/libstore/linux/include/nix/personality\.hh$''
''^src/libstore/local-binary-cache-store\.cc$'' ''^src/libstore/local-binary-cache-store\.cc$''
''^src/libstore/local-fs-store\.cc$'' ''^src/libstore/local-fs-store\.cc$''
''^src/libstore/local-fs-store\.hh$'' ''^src/libstore/include/nix/local-fs-store\.hh$''
''^src/libstore/log-store\.cc$'' ''^src/libstore/log-store\.cc$''
''^src/libstore/log-store\.hh$'' ''^src/libstore/include/nix/log-store\.hh$''
''^src/libstore/machines\.cc$'' ''^src/libstore/machines\.cc$''
''^src/libstore/machines\.hh$'' ''^src/libstore/include/nix/machines\.hh$''
''^src/libstore/make-content-addressed\.cc$'' ''^src/libstore/make-content-addressed\.cc$''
''^src/libstore/make-content-addressed\.hh$'' ''^src/libstore/include/nix/make-content-addressed\.hh$''
''^src/libstore/misc\.cc$'' ''^src/libstore/misc\.cc$''
''^src/libstore/names\.cc$'' ''^src/libstore/names\.cc$''
''^src/libstore/names\.hh$'' ''^src/libstore/include/nix/names\.hh$''
''^src/libstore/nar-accessor\.cc$'' ''^src/libstore/nar-accessor\.cc$''
''^src/libstore/nar-accessor\.hh$'' ''^src/libstore/include/nix/nar-accessor\.hh$''
''^src/libstore/nar-info-disk-cache\.cc$'' ''^src/libstore/nar-info-disk-cache\.cc$''
''^src/libstore/nar-info-disk-cache\.hh$'' ''^src/libstore/include/nix/nar-info-disk-cache\.hh$''
''^src/libstore/nar-info\.cc$'' ''^src/libstore/nar-info\.cc$''
''^src/libstore/nar-info\.hh$'' ''^src/libstore/include/nix/nar-info\.hh$''
''^src/libstore/outputs-spec\.cc$'' ''^src/libstore/outputs-spec\.cc$''
''^src/libstore/outputs-spec\.hh$'' ''^src/libstore/include/nix/outputs-spec\.hh$''
''^src/libstore/parsed-derivations\.cc$'' ''^src/libstore/parsed-derivations\.cc$''
''^src/libstore/path-info\.cc$'' ''^src/libstore/path-info\.cc$''
''^src/libstore/path-info\.hh$'' ''^src/libstore/include/nix/path-info\.hh$''
''^src/libstore/path-references\.cc$'' ''^src/libstore/path-references\.cc$''
''^src/libstore/path-regex\.hh$'' ''^src/libstore/include/nix/path-regex\.hh$''
''^src/libstore/path-with-outputs\.cc$'' ''^src/libstore/path-with-outputs\.cc$''
''^src/libstore/path\.cc$'' ''^src/libstore/path\.cc$''
''^src/libstore/path\.hh$'' ''^src/libstore/include/nix/path\.hh$''
''^src/libstore/pathlocks\.cc$'' ''^src/libstore/pathlocks\.cc$''
''^src/libstore/pathlocks\.hh$'' ''^src/libstore/include/nix/pathlocks\.hh$''
''^src/libstore/profiles\.cc$'' ''^src/libstore/profiles\.cc$''
''^src/libstore/profiles\.hh$'' ''^src/libstore/include/nix/profiles\.hh$''
''^src/libstore/realisation\.cc$'' ''^src/libstore/realisation\.cc$''
''^src/libstore/realisation\.hh$'' ''^src/libstore/include/nix/realisation\.hh$''
''^src/libstore/remote-fs-accessor\.cc$'' ''^src/libstore/remote-fs-accessor\.cc$''
''^src/libstore/remote-fs-accessor\.hh$'' ''^src/libstore/include/nix/remote-fs-accessor\.hh$''
''^src/libstore/remote-store-connection\.hh$'' ''^src/libstore/include/nix/remote-store-connection\.hh$''
''^src/libstore/remote-store\.cc$'' ''^src/libstore/remote-store\.cc$''
''^src/libstore/remote-store\.hh$'' ''^src/libstore/include/nix/remote-store\.hh$''
''^src/libstore/s3-binary-cache-store\.cc$'' ''^src/libstore/s3-binary-cache-store\.cc$''
''^src/libstore/s3\.hh$'' ''^src/libstore/include/nix/s3\.hh$''
''^src/libstore/serve-protocol-impl\.cc$'' ''^src/libstore/serve-protocol-impl\.cc$''
''^src/libstore/serve-protocol-impl\.hh$'' ''^src/libstore/include/nix/serve-protocol-impl\.hh$''
''^src/libstore/serve-protocol\.cc$'' ''^src/libstore/serve-protocol\.cc$''
''^src/libstore/serve-protocol\.hh$'' ''^src/libstore/include/nix/serve-protocol\.hh$''
''^src/libstore/sqlite\.cc$'' ''^src/libstore/sqlite\.cc$''
''^src/libstore/sqlite\.hh$'' ''^src/libstore/include/nix/sqlite\.hh$''
''^src/libstore/ssh-store\.cc$'' ''^src/libstore/ssh-store\.cc$''
''^src/libstore/ssh\.cc$'' ''^src/libstore/ssh\.cc$''
''^src/libstore/ssh\.hh$'' ''^src/libstore/include/nix/ssh\.hh$''
''^src/libstore/store-api\.cc$'' ''^src/libstore/store-api\.cc$''
''^src/libstore/store-api\.hh$'' ''^src/libstore/include/nix/store-api\.hh$''
''^src/libstore/store-dir-config\.hh$'' ''^src/libstore/include/nix/store-dir-config\.hh$''
''^src/libstore/build/derivation-goal\.cc$'' ''^src/libstore/build/derivation-goal\.cc$''
''^src/libstore/build/derivation-goal\.hh$'' ''^src/libstore/include/nix/build/derivation-goal\.hh$''
''^src/libstore/build/drv-output-substitution-goal\.cc$'' ''^src/libstore/build/drv-output-substitution-goal\.cc$''
''^src/libstore/build/drv-output-substitution-goal\.hh$'' ''^src/libstore/include/nix/build/drv-output-substitution-goal\.hh$''
''^src/libstore/build/entry-points\.cc$'' ''^src/libstore/build/entry-points\.cc$''
''^src/libstore/build/goal\.cc$'' ''^src/libstore/build/goal\.cc$''
''^src/libstore/build/goal\.hh$'' ''^src/libstore/include/nix/build/goal\.hh$''
''^src/libstore/unix/build/hook-instance\.cc$'' ''^src/libstore/unix/build/hook-instance\.cc$''
''^src/libstore/unix/build/local-derivation-goal\.cc$'' ''^src/libstore/unix/build/local-derivation-goal\.cc$''
''^src/libstore/unix/build/local-derivation-goal\.hh$'' ''^src/libstore/unix/include/nix/build/local-derivation-goal\.hh$''
''^src/libstore/build/substitution-goal\.cc$'' ''^src/libstore/build/substitution-goal\.cc$''
''^src/libstore/build/substitution-goal\.hh$'' ''^src/libstore/include/nix/build/substitution-goal\.hh$''
''^src/libstore/build/worker\.cc$'' ''^src/libstore/build/worker\.cc$''
''^src/libstore/build/worker\.hh$'' ''^src/libstore/include/nix/build/worker\.hh$''
''^src/libstore/builtins/fetchurl\.cc$'' ''^src/libstore/builtins/fetchurl\.cc$''
''^src/libstore/builtins/unpack-channel\.cc$'' ''^src/libstore/builtins/unpack-channel\.cc$''
''^src/libstore/gc\.cc$'' ''^src/libstore/gc\.cc$''
''^src/libstore/local-overlay-store\.cc$'' ''^src/libstore/local-overlay-store\.cc$''
''^src/libstore/local-overlay-store\.hh$'' ''^src/libstore/include/nix/local-overlay-store\.hh$''
''^src/libstore/local-store\.cc$'' ''^src/libstore/local-store\.cc$''
''^src/libstore/local-store\.hh$'' ''^src/libstore/include/nix/local-store\.hh$''
''^src/libstore/unix/user-lock\.cc$'' ''^src/libstore/unix/user-lock\.cc$''
''^src/libstore/unix/user-lock\.hh$'' ''^src/libstore/unix/include/nix/user-lock\.hh$''
''^src/libstore/optimise-store\.cc$'' ''^src/libstore/optimise-store\.cc$''
''^src/libstore/unix/pathlocks\.cc$'' ''^src/libstore/unix/pathlocks\.cc$''
''^src/libstore/posix-fs-canonicalise\.cc$'' ''^src/libstore/posix-fs-canonicalise\.cc$''
''^src/libstore/posix-fs-canonicalise\.hh$'' ''^src/libstore/include/nix/posix-fs-canonicalise\.hh$''
''^src/libstore/uds-remote-store\.cc$'' ''^src/libstore/uds-remote-store\.cc$''
''^src/libstore/uds-remote-store\.hh$'' ''^src/libstore/include/nix/uds-remote-store\.hh$''
''^src/libstore/windows/build\.cc$'' ''^src/libstore/windows/build\.cc$''
''^src/libstore/worker-protocol-impl\.hh$'' ''^src/libstore/include/nix/worker-protocol-impl\.hh$''
''^src/libstore/worker-protocol\.cc$'' ''^src/libstore/worker-protocol\.cc$''
''^src/libstore/worker-protocol\.hh$'' ''^src/libstore/include/nix/worker-protocol\.hh$''
''^src/libutil-c/nix_api_util_internal\.h$'' ''^src/libutil-c/nix_api_util_internal\.h$''
''^src/libutil/archive\.cc$'' ''^src/libutil/archive\.cc$''
''^src/libutil/archive\.hh$'' ''^src/libutil/include/nix/archive\.hh$''
''^src/libutil/args\.cc$'' ''^src/libutil/args\.cc$''
''^src/libutil/args\.hh$'' ''^src/libutil/include/nix/args\.hh$''
''^src/libutil/args/root\.hh$'' ''^src/libutil/include/nix/args/root\.hh$''
''^src/libutil/callback\.hh$'' ''^src/libutil/include/nix/callback\.hh$''
''^src/libutil/canon-path\.cc$'' ''^src/libutil/canon-path\.cc$''
''^src/libutil/canon-path\.hh$'' ''^src/libutil/include/nix/canon-path\.hh$''
''^src/libutil/chunked-vector\.hh$'' ''^src/libutil/include/nix/chunked-vector\.hh$''
''^src/libutil/closure\.hh$'' ''^src/libutil/include/nix/closure\.hh$''
''^src/libutil/comparator\.hh$'' ''^src/libutil/include/nix/comparator\.hh$''
''^src/libutil/compute-levels\.cc$'' ''^src/libutil/compute-levels\.cc$''
''^src/libutil/config-impl\.hh$'' ''^src/libutil/include/nix/config-impl\.hh$''
''^src/libutil/config\.cc$'' ''^src/libutil/config\.cc$''
''^src/libutil/config\.hh$'' ''^src/libutil/include/nix/config\.hh$''
''^src/libutil/current-process\.cc$'' ''^src/libutil/current-process\.cc$''
''^src/libutil/current-process\.hh$'' ''^src/libutil/include/nix/current-process\.hh$''
''^src/libutil/english\.cc$'' ''^src/libutil/english\.cc$''
''^src/libutil/english\.hh$'' ''^src/libutil/include/nix/english\.hh$''
''^src/libutil/error\.cc$'' ''^src/libutil/error\.cc$''
''^src/libutil/error\.hh$'' ''^src/libutil/include/nix/error\.hh$''
''^src/libutil/exit\.hh$'' ''^src/libutil/include/nix/exit\.hh$''
''^src/libutil/experimental-features\.cc$'' ''^src/libutil/experimental-features\.cc$''
''^src/libutil/experimental-features\.hh$'' ''^src/libutil/include/nix/experimental-features\.hh$''
''^src/libutil/file-content-address\.cc$'' ''^src/libutil/file-content-address\.cc$''
''^src/libutil/file-content-address\.hh$'' ''^src/libutil/include/nix/file-content-address\.hh$''
''^src/libutil/file-descriptor\.cc$'' ''^src/libutil/file-descriptor\.cc$''
''^src/libutil/file-descriptor\.hh$'' ''^src/libutil/include/nix/file-descriptor\.hh$''
''^src/libutil/file-path-impl\.hh$'' ''^src/libutil/include/nix/file-path-impl\.hh$''
''^src/libutil/file-path\.hh$'' ''^src/libutil/include/nix/file-path\.hh$''
''^src/libutil/file-system\.cc$'' ''^src/libutil/file-system\.cc$''
''^src/libutil/file-system\.hh$'' ''^src/libutil/include/nix/file-system\.hh$''
''^src/libutil/finally\.hh$'' ''^src/libutil/include/nix/finally\.hh$''
''^src/libutil/fmt\.hh$'' ''^src/libutil/include/nix/fmt\.hh$''
''^src/libutil/fs-sink\.cc$'' ''^src/libutil/fs-sink\.cc$''
''^src/libutil/fs-sink\.hh$'' ''^src/libutil/include/nix/fs-sink\.hh$''
''^src/libutil/git\.cc$'' ''^src/libutil/git\.cc$''
''^src/libutil/git\.hh$'' ''^src/libutil/include/nix/git\.hh$''
''^src/libutil/hash\.cc$'' ''^src/libutil/hash\.cc$''
''^src/libutil/hash\.hh$'' ''^src/libutil/include/nix/hash\.hh$''
''^src/libutil/hilite\.cc$'' ''^src/libutil/hilite\.cc$''
''^src/libutil/hilite\.hh$'' ''^src/libutil/include/nix/hilite\.hh$''
''^src/libutil/source-accessor\.hh$'' ''^src/libutil/source-accessor\.hh$''
''^src/libutil/json-impls\.hh$'' ''^src/libutil/include/nix/json-impls\.hh$''
''^src/libutil/json-utils\.cc$'' ''^src/libutil/json-utils\.cc$''
''^src/libutil/json-utils\.hh$'' ''^src/libutil/include/nix/json-utils\.hh$''
''^src/libutil/linux/cgroup\.cc$'' ''^src/libutil/linux/cgroup\.cc$''
''^src/libutil/linux/namespaces\.cc$'' ''^src/libutil/linux/namespaces\.cc$''
''^src/libutil/logging\.cc$'' ''^src/libutil/logging\.cc$''
''^src/libutil/logging\.hh$'' ''^src/libutil/include/nix/logging\.hh$''
''^src/libutil/lru-cache\.hh$'' ''^src/libutil/include/nix/lru-cache\.hh$''
''^src/libutil/memory-source-accessor\.cc$'' ''^src/libutil/memory-source-accessor\.cc$''
''^src/libutil/memory-source-accessor\.hh$'' ''^src/libutil/include/nix/memory-source-accessor\.hh$''
''^src/libutil/pool\.hh$'' ''^src/libutil/include/nix/pool\.hh$''
''^src/libutil/position\.cc$'' ''^src/libutil/position\.cc$''
''^src/libutil/position\.hh$'' ''^src/libutil/include/nix/position\.hh$''
''^src/libutil/posix-source-accessor\.cc$'' ''^src/libutil/posix-source-accessor\.cc$''
''^src/libutil/posix-source-accessor\.hh$'' ''^src/libutil/include/nix/posix-source-accessor\.hh$''
''^src/libutil/processes\.hh$'' ''^src/libutil/include/nix/processes\.hh$''
''^src/libutil/ref\.hh$'' ''^src/libutil/include/nix/ref\.hh$''
''^src/libutil/references\.cc$'' ''^src/libutil/references\.cc$''
''^src/libutil/references\.hh$'' ''^src/libutil/include/nix/references\.hh$''
''^src/libutil/regex-combinators\.hh$'' ''^src/libutil/regex-combinators\.hh$''
''^src/libutil/serialise\.cc$'' ''^src/libutil/serialise\.cc$''
''^src/libutil/serialise\.hh$'' ''^src/libutil/include/nix/serialise\.hh$''
''^src/libutil/signals\.hh$'' ''^src/libutil/include/nix/signals\.hh$''
''^src/libutil/signature/local-keys\.cc$'' ''^src/libutil/signature/local-keys\.cc$''
''^src/libutil/signature/local-keys\.hh$'' ''^src/libutil/include/nix/signature/local-keys\.hh$''
''^src/libutil/signature/signer\.cc$'' ''^src/libutil/signature/signer\.cc$''
''^src/libutil/signature/signer\.hh$'' ''^src/libutil/include/nix/signature/signer\.hh$''
''^src/libutil/source-accessor\.cc$'' ''^src/libutil/source-accessor\.cc$''
''^src/libutil/source-accessor\.hh$'' ''^src/libutil/include/nix/source-accessor\.hh$''
''^src/libutil/source-path\.cc$'' ''^src/libutil/source-path\.cc$''
''^src/libutil/source-path\.hh$'' ''^src/libutil/include/nix/source-path\.hh$''
''^src/libutil/split\.hh$'' ''^src/libutil/include/nix/split\.hh$''
''^src/libutil/suggestions\.cc$'' ''^src/libutil/suggestions\.cc$''
''^src/libutil/suggestions\.hh$'' ''^src/libutil/include/nix/suggestions\.hh$''
''^src/libutil/sync\.hh$'' ''^src/libutil/include/nix/sync\.hh$''
''^src/libutil/terminal\.cc$'' ''^src/libutil/terminal\.cc$''
''^src/libutil/terminal\.hh$'' ''^src/libutil/include/nix/terminal\.hh$''
''^src/libutil/thread-pool\.cc$'' ''^src/libutil/thread-pool\.cc$''
''^src/libutil/thread-pool\.hh$'' ''^src/libutil/include/nix/thread-pool\.hh$''
''^src/libutil/topo-sort\.hh$'' ''^src/libutil/include/nix/topo-sort\.hh$''
''^src/libutil/types\.hh$'' ''^src/libutil/include/nix/types\.hh$''
''^src/libutil/unix/file-descriptor\.cc$'' ''^src/libutil/unix/file-descriptor\.cc$''
''^src/libutil/unix/file-path\.cc$'' ''^src/libutil/unix/file-path\.cc$''
''^src/libutil/unix/processes\.cc$'' ''^src/libutil/unix/processes\.cc$''
''^src/libutil/unix/signals-impl\.hh$'' ''^src/libutil/unix/include/nix/signals-impl\.hh$''
''^src/libutil/unix/signals\.cc$'' ''^src/libutil/unix/signals\.cc$''
''^src/libutil/unix-domain-socket\.cc$'' ''^src/libutil/unix-domain-socket\.cc$''
''^src/libutil/unix/users\.cc$'' ''^src/libutil/unix/users\.cc$''
''^src/libutil/url-parts\.hh$'' ''^src/libutil/include/nix/url-parts\.hh$''
''^src/libutil/url\.cc$'' ''^src/libutil/url\.cc$''
''^src/libutil/url\.hh$'' ''^src/libutil/include/nix/url\.hh$''
''^src/libutil/users\.cc$'' ''^src/libutil/users\.cc$''
''^src/libutil/users\.hh$'' ''^src/libutil/include/nix/users\.hh$''
''^src/libutil/util\.cc$'' ''^src/libutil/util\.cc$''
''^src/libutil/util\.hh$'' ''^src/libutil/include/nix/util\.hh$''
''^src/libutil/variant-wrapper\.hh$'' ''^src/libutil/include/nix/variant-wrapper\.hh$''
''^src/libutil/widecharwidth/widechar_width\.h$'' # vendored source ''^src/libutil/widecharwidth/widechar_width\.h$'' # vendored source
''^src/libutil/windows/file-descriptor\.cc$'' ''^src/libutil/windows/file-descriptor\.cc$''
''^src/libutil/windows/file-path\.cc$'' ''^src/libutil/windows/file-path\.cc$''
''^src/libutil/windows/processes\.cc$'' ''^src/libutil/windows/processes\.cc$''
''^src/libutil/windows/users\.cc$'' ''^src/libutil/windows/users\.cc$''
''^src/libutil/windows/windows-error\.cc$'' ''^src/libutil/windows/windows-error\.cc$''
''^src/libutil/windows/windows-error\.hh$'' ''^src/libutil/windows/include/nix/windows-error\.hh$''
''^src/libutil/xml-writer\.cc$'' ''^src/libutil/xml-writer\.cc$''
''^src/libutil/xml-writer\.hh$'' ''^src/libutil/include/nix/xml-writer\.hh$''
''^src/nix-build/nix-build\.cc$'' ''^src/nix-build/nix-build\.cc$''
''^src/nix-channel/nix-channel\.cc$'' ''^src/nix-channel/nix-channel\.cc$''
''^src/nix-collect-garbage/nix-collect-garbage\.cc$'' ''^src/nix-collect-garbage/nix-collect-garbage\.cc$''
@ -481,9 +481,9 @@
''^tests/nixos/ca-fd-leak/sender\.c'' ''^tests/nixos/ca-fd-leak/sender\.c''
''^tests/nixos/ca-fd-leak/smuggler\.c'' ''^tests/nixos/ca-fd-leak/smuggler\.c''
''^tests/nixos/user-sandboxing/attacker\.c'' ''^tests/nixos/user-sandboxing/attacker\.c''
''^src/libexpr-test-support/tests/libexpr\.hh'' ''^src/libexpr-test-support/include/nix/tests/libexpr\.hh''
''^src/libexpr-test-support/tests/value/context\.cc'' ''^src/libexpr-test-support/tests/value/context\.cc''
''^src/libexpr-test-support/tests/value/context\.hh'' ''^src/libexpr-test-support/include/nix/tests/value/context\.hh''
''^src/libexpr-tests/derived-path\.cc'' ''^src/libexpr-tests/derived-path\.cc''
''^src/libexpr-tests/error_traces\.cc'' ''^src/libexpr-tests/error_traces\.cc''
''^src/libexpr-tests/eval\.cc'' ''^src/libexpr-tests/eval\.cc''
@ -498,13 +498,13 @@
''^src/libflake-tests/flakeref\.cc'' ''^src/libflake-tests/flakeref\.cc''
''^src/libflake-tests/url-name\.cc'' ''^src/libflake-tests/url-name\.cc''
''^src/libstore-test-support/tests/derived-path\.cc'' ''^src/libstore-test-support/tests/derived-path\.cc''
''^src/libstore-test-support/tests/derived-path\.hh'' ''^src/libstore-test-support/include/nix/tests/derived-path\.hh''
''^src/libstore-test-support/tests/nix_api_store\.hh'' ''^src/libstore-test-support/include/nix/tests/nix_api_store\.hh''
''^src/libstore-test-support/tests/outputs-spec\.cc'' ''^src/libstore-test-support/tests/outputs-spec\.cc''
''^src/libstore-test-support/tests/outputs-spec\.hh'' ''^src/libstore-test-support/include/nix/tests/outputs-spec\.hh''
''^src/libstore-test-support/tests/path\.cc'' ''^src/libstore-test-support/path\.cc''
''^src/libstore-test-support/tests/path\.hh'' ''^src/libstore-test-support/include/nix/tests/path\.hh''
''^src/libstore-test-support/tests/protocol\.hh'' ''^src/libstore-test-support/include/nix/tests/protocol\.hh''
''^src/libstore-tests/common-protocol\.cc'' ''^src/libstore-tests/common-protocol\.cc''
''^src/libstore-tests/content-address\.cc'' ''^src/libstore-tests/content-address\.cc''
''^src/libstore-tests/derivation\.cc'' ''^src/libstore-tests/derivation\.cc''
@ -518,9 +518,9 @@
''^src/libstore-tests/path\.cc'' ''^src/libstore-tests/path\.cc''
''^src/libstore-tests/serve-protocol\.cc'' ''^src/libstore-tests/serve-protocol\.cc''
''^src/libstore-tests/worker-protocol\.cc'' ''^src/libstore-tests/worker-protocol\.cc''
''^src/libutil-test-support/tests/characterization\.hh'' ''^src/libutil-test-support/include/nix/tests/characterization\.hh''
''^src/libutil-test-support/tests/hash\.cc'' ''^src/libutil-test-support/hash\.cc''
''^src/libutil-test-support/tests/hash\.hh'' ''^src/libutil-test-support/include/nix/tests/hash\.hh''
''^src/libutil-tests/args\.cc'' ''^src/libutil-tests/args\.cc''
''^src/libutil-tests/canon-path\.cc'' ''^src/libutil-tests/canon-path\.cc''
''^src/libutil-tests/chunked-vector\.cc'' ''^src/libutil-tests/chunked-vector\.cc''

83
maintainers/link-headers Executable file
View file

@ -0,0 +1,83 @@
#!/usr/bin/env python3
# This script must be run from the root of the Nix repository.
#
# For include path hygiene, we need to put headers in a separate
# directory than sources. But during development, it is nice to paths
# that are similar for headers and source files, e.g.
# `foo/bar/baz.{cc,hh}`, e.g. for less typing when opening one file, and
# then opening the other file.
#
# This script symlinks the headers next to the source files to
# facilitate such a development workflows. It also updates
# `.git/info/exclude` so that the symlinks are not accidentally committed
# by mistake.
from pathlib import Path
import subprocess
import os
def main() -> None:
# Path to the source directory
GIT_TOPLEVEL = Path(
subprocess.run(
["git", "rev-parse", "--show-toplevel"],
text=True,
stdout=subprocess.PIPE,
check=True,
).stdout.strip()
)
# Get header files from git
result = subprocess.run(
["git", "-C", str(GIT_TOPLEVEL), "ls-files", "*/include/nix/**.hh"],
text=True,
stdout=subprocess.PIPE,
check=True,
)
header_files = result.stdout.strip().split("\n")
header_files.sort()
links = []
for file_str in header_files:
project_str, header_str = file_str.split("/include/nix/", 1)
project = Path(project_str)
header = Path(header_str)
# Reconstruct the full path (relative to SRC_DIR) to the header file.
file = project / "include" / "nix" / header
# The symlink should be created at "project/header", i.e. next to the project's sources.
link = project / header
# Compute a relative path from the symlink's parent directory to the actual header file.
relative_source = os.path.relpath(
GIT_TOPLEVEL / file, GIT_TOPLEVEL / link.parent
)
# Create the symbolic link.
full_link_path = GIT_TOPLEVEL / link
full_link_path.parent.mkdir(parents=True, exist_ok=True)
if full_link_path.is_symlink():
full_link_path.unlink()
full_link_path.symlink_to(relative_source)
links.append(link)
# Generate .gitignore file
gitignore_path = GIT_TOPLEVEL / ".git" / "info" / "exclude"
gitignore_path.parent.mkdir(parents=True, exist_ok=True)
with gitignore_path.open("w") as gitignore:
gitignore.write("# DO NOT EDIT! Autogenerated\n")
gitignore.write(
"# Symlinks for headers to be next to sources for development\n"
)
gitignore.write('# Run "maintainers/link-headers" to regenerate\n\n')
gitignore.write('# Run "maintainers/link-headers" to regenerate\n\n')
for link in links:
gitignore.write(f"/{link}\n")
if __name__ == "__main__":
main()

View file

@ -16,7 +16,6 @@ import('pkgconfig').generate(
filebase : meson.project_name(), filebase : meson.project_name(),
name : 'Nix', name : 'Nix',
description : 'Nix Package Manager', description : 'Nix Package Manager',
subdirs : ['nix'],
extra_cflags : ['-std=c++2a'], extra_cflags : ['-std=c++2a'],
requires : requires_public, requires : requires_public,
requires_private : requires_private, requires_private : requires_private,

View file

@ -1,7 +1,7 @@
# Only execute this file once per shell. # Only execute this file once per shell.
# This file is tested by tests/installer/default.nix. # This file is tested by tests/installer/default.nix.
if [ -n "${__ETC_PROFILE_NIX_SOURCED:-}" ]; then return; fi if [ -n "${__ETC_PROFILE_NIX_SOURCED:-}" ]; then return; fi
__ETC_PROFILE_NIX_SOURCED=1 export __ETC_PROFILE_NIX_SOURCED=1
NIX_LINK=$HOME/.nix-profile NIX_LINK=$HOME/.nix-profile
if [ -n "${XDG_STATE_HOME-}" ]; then if [ -n "${XDG_STATE_HOME-}" ]; then

View file

@ -9,19 +9,19 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#include "machines.hh" #include "nix/machines.hh"
#include "shared.hh" #include "nix/shared.hh"
#include "plugin.hh" #include "nix/plugin.hh"
#include "pathlocks.hh" #include "nix/pathlocks.hh"
#include "globals.hh" #include "nix/globals.hh"
#include "serialise.hh" #include "nix/serialise.hh"
#include "build-result.hh" #include "nix/build-result.hh"
#include "store-api.hh" #include "nix/store-api.hh"
#include "strings.hh" #include "nix/strings.hh"
#include "derivations.hh" #include "nix/derivations.hh"
#include "local-store.hh" #include "nix/local-store.hh"
#include "legacy.hh" #include "nix/legacy.hh"
#include "experimental-features.hh" #include "nix/experimental-features.hh"
using namespace nix; using namespace nix;
using std::cin; using std::cin;

View file

@ -1,7 +1,7 @@
#include "built-path.hh" #include "nix/built-path.hh"
#include "derivations.hh" #include "nix/derivations.hh"
#include "store-api.hh" #include "nix/store-api.hh"
#include "comparator.hh" #include "nix/comparator.hh"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>

View file

@ -1,4 +1,4 @@
#include "command-installable-value.hh" #include "nix/command-installable-value.hh"
namespace nix { namespace nix {

View file

@ -1,16 +1,16 @@
#include <algorithm> #include <algorithm>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "command.hh" #include "nix/command.hh"
#include "markdown.hh" #include "nix/markdown.hh"
#include "store-api.hh" #include "nix/store-api.hh"
#include "local-fs-store.hh" #include "nix/local-fs-store.hh"
#include "derivations.hh" #include "nix/derivations.hh"
#include "nixexpr.hh" #include "nix/nixexpr.hh"
#include "profiles.hh" #include "nix/profiles.hh"
#include "repl.hh" #include "nix/repl.hh"
#include "strings.hh" #include "nix/strings.hh"
#include "environment-variables.hh" #include "nix/environment-variables.hh"
namespace nix { namespace nix {

View file

@ -1,20 +1,20 @@
#include "fetch-settings.hh" #include "nix/fetch-settings.hh"
#include "eval-settings.hh" #include "nix/eval-settings.hh"
#include "common-eval-args.hh" #include "nix/common-eval-args.hh"
#include "shared.hh" #include "nix/shared.hh"
#include "config-global.hh" #include "nix/config-global.hh"
#include "filetransfer.hh" #include "nix/filetransfer.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "fetchers.hh" #include "nix/fetchers.hh"
#include "registry.hh" #include "nix/registry.hh"
#include "flake/flakeref.hh" #include "nix/flake/flakeref.hh"
#include "flake/settings.hh" #include "nix/flake/settings.hh"
#include "store-api.hh" #include "nix/store-api.hh"
#include "command.hh" #include "nix/command.hh"
#include "tarball.hh" #include "nix/tarball.hh"
#include "fetch-to-store.hh" #include "nix/fetch-to-store.hh"
#include "compatibility-settings.hh" #include "nix/compatibility-settings.hh"
#include "eval-settings.hh" #include "nix/eval-settings.hh"
namespace nix { namespace nix {

View file

@ -1,6 +1,6 @@
#include "editor-for.hh" #include "nix/editor-for.hh"
#include "environment-variables.hh" #include "nix/environment-variables.hh"
#include "source-path.hh" #include "nix/source-path.hh"
namespace nix { namespace nix {

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
///@file ///@file
#include "derived-path.hh" #include "nix/derived-path.hh"
#include "realisation.hh" #include "nix/realisation.hh"
namespace nix { namespace nix {

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
///@file ///@file
#include "installable-value.hh" #include "nix/installable-value.hh"
#include "command.hh" #include "nix/command.hh"
namespace nix { namespace nix {

View file

@ -1,11 +1,11 @@
#pragma once #pragma once
///@file ///@file
#include "installable-value.hh" #include "nix/installable-value.hh"
#include "args.hh" #include "nix/args.hh"
#include "common-eval-args.hh" #include "nix/common-eval-args.hh"
#include "path.hh" #include "nix/path.hh"
#include "flake/lockfile.hh" #include "nix/flake/lockfile.hh"
#include <optional> #include <optional>

View file

@ -1,10 +1,10 @@
#pragma once #pragma once
///@file ///@file
#include "args.hh" #include "nix/args.hh"
#include "canon-path.hh" #include "nix/canon-path.hh"
#include "common-args.hh" #include "nix/common-args.hh"
#include "search-path.hh" #include "nix/search-path.hh"
#include <filesystem> #include <filesystem>

View file

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "config.hh" #include "nix/config.hh"
namespace nix { namespace nix {
struct CompatibilitySettings : public Config struct CompatibilitySettings : public Config

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
///@file ///@file
#include "types.hh" #include "nix/types.hh"
#include "source-path.hh" #include "nix/source-path.hh"
namespace nix { namespace nix {

View file

@ -1,22 +1,22 @@
#pragma once #pragma once
///@file ///@file
#include "globals.hh" #include "nix/globals.hh"
#include "installable-value.hh" #include "nix/installable-value.hh"
#include "outputs-spec.hh" #include "nix/outputs-spec.hh"
#include "command.hh" #include "nix/command.hh"
#include "attr-path.hh" #include "nix/attr-path.hh"
#include "common-eval-args.hh" #include "nix/common-eval-args.hh"
#include "derivations.hh" #include "nix/derivations.hh"
#include "eval-inline.hh" #include "nix/eval-inline.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "get-drvs.hh" #include "nix/get-drvs.hh"
#include "store-api.hh" #include "nix/store-api.hh"
#include "shared.hh" #include "nix/shared.hh"
#include "eval-cache.hh" #include "nix/eval-cache.hh"
#include "url.hh" #include "nix/url.hh"
#include "registry.hh" #include "nix/registry.hh"
#include "build-result.hh" #include "nix/build-result.hh"
#include <regex> #include <regex>
#include <queue> #include <queue>

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
///@file ///@file
#include "installables.hh" #include "nix/installables.hh"
namespace nix { namespace nix {

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
///@file ///@file
#include "common-eval-args.hh" #include "nix/common-eval-args.hh"
#include "installable-value.hh" #include "nix/installable-value.hh"
namespace nix { namespace nix {

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
///@file ///@file
#include "installables.hh" #include "nix/installables.hh"
#include "flake/flake.hh" #include "nix/flake/flake.hh"
namespace nix { namespace nix {

View file

@ -1,12 +1,12 @@
#pragma once #pragma once
///@file ///@file
#include "path.hh" #include "nix/path.hh"
#include "outputs-spec.hh" #include "nix/outputs-spec.hh"
#include "derived-path.hh" #include "nix/derived-path.hh"
#include "built-path.hh" #include "nix/built-path.hh"
#include "store-api.hh" #include "nix/store-api.hh"
#include "build-result.hh" #include "nix/build-result.hh"
#include <optional> #include <optional>

View file

@ -0,0 +1,23 @@
# Public headers directory
include_dirs = [include_directories('..')]
headers = files(
'built-path.hh',
'command-installable-value.hh',
'command.hh',
'common-eval-args.hh',
'compatibility-settings.hh',
'editor-for.hh',
'installable-attr-path.hh',
'installable-derived-path.hh',
'installable-flake.hh',
'installable-value.hh',
'installables.hh',
'legacy.hh',
'markdown.hh',
'misc-store-flags.hh',
'network-proxy.hh',
'repl-interacter.hh',
'repl.hh',
)

View file

@ -1,5 +1,5 @@
#include "args.hh" #include "nix/args.hh"
#include "content-address.hh" #include "nix/content-address.hh"
namespace nix::flag { namespace nix::flag {

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
///@file ///@file
#include "types.hh" #include "nix/types.hh"
namespace nix { namespace nix {

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
/// @file /// @file
#include "finally.hh" #include "nix/finally.hh"
#include "types.hh" #include "nix/types.hh"
#include <functional> #include <functional>
#include <string> #include <string>

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
///@file ///@file
#include "eval.hh" #include "nix/eval.hh"
namespace nix { namespace nix {

View file

@ -1,21 +1,21 @@
#include "globals.hh" #include "nix/globals.hh"
#include "installable-attr-path.hh" #include "nix/installable-attr-path.hh"
#include "outputs-spec.hh" #include "nix/outputs-spec.hh"
#include "util.hh" #include "nix/util.hh"
#include "command.hh" #include "nix/command.hh"
#include "attr-path.hh" #include "nix/attr-path.hh"
#include "common-eval-args.hh" #include "nix/common-eval-args.hh"
#include "derivations.hh" #include "nix/derivations.hh"
#include "eval-inline.hh" #include "nix/eval-inline.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "get-drvs.hh" #include "nix/get-drvs.hh"
#include "store-api.hh" #include "nix/store-api.hh"
#include "shared.hh" #include "nix/shared.hh"
#include "flake/flake.hh" #include "nix/flake/flake.hh"
#include "eval-cache.hh" #include "nix/eval-cache.hh"
#include "url.hh" #include "nix/url.hh"
#include "registry.hh" #include "nix/registry.hh"
#include "build-result.hh" #include "nix/build-result.hh"
#include <regex> #include <regex>
#include <queue> #include <queue>

View file

@ -1,5 +1,5 @@
#include "installable-derived-path.hh" #include "nix/installable-derived-path.hh"
#include "derivations.hh" #include "nix/derivations.hh"
namespace nix { namespace nix {

View file

@ -1,22 +1,22 @@
#include "globals.hh" #include "nix/globals.hh"
#include "installable-flake.hh" #include "nix/installable-flake.hh"
#include "installable-derived-path.hh" #include "nix/installable-derived-path.hh"
#include "outputs-spec.hh" #include "nix/outputs-spec.hh"
#include "util.hh" #include "nix/util.hh"
#include "command.hh" #include "nix/command.hh"
#include "attr-path.hh" #include "nix/attr-path.hh"
#include "common-eval-args.hh" #include "nix/common-eval-args.hh"
#include "derivations.hh" #include "nix/derivations.hh"
#include "eval-inline.hh" #include "nix/eval-inline.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "get-drvs.hh" #include "nix/get-drvs.hh"
#include "store-api.hh" #include "nix/store-api.hh"
#include "shared.hh" #include "nix/shared.hh"
#include "flake/flake.hh" #include "nix/flake/flake.hh"
#include "eval-cache.hh" #include "nix/eval-cache.hh"
#include "url.hh" #include "nix/url.hh"
#include "registry.hh" #include "nix/registry.hh"
#include "build-result.hh" #include "nix/build-result.hh"
#include <regex> #include <regex>
#include <queue> #include <queue>

View file

@ -1,6 +1,6 @@
#include "installable-value.hh" #include "nix/installable-value.hh"
#include "eval-cache.hh" #include "nix/eval-cache.hh"
#include "fetch-to-store.hh" #include "nix/fetch-to-store.hh"
namespace nix { namespace nix {

View file

@ -1,33 +1,33 @@
#include "globals.hh" #include "nix/globals.hh"
#include "installables.hh" #include "nix/installables.hh"
#include "installable-derived-path.hh" #include "nix/installable-derived-path.hh"
#include "installable-attr-path.hh" #include "nix/installable-attr-path.hh"
#include "installable-flake.hh" #include "nix/installable-flake.hh"
#include "outputs-spec.hh" #include "nix/outputs-spec.hh"
#include "users.hh" #include "nix/users.hh"
#include "util.hh" #include "nix/util.hh"
#include "command.hh" #include "nix/command.hh"
#include "attr-path.hh" #include "nix/attr-path.hh"
#include "common-eval-args.hh" #include "nix/common-eval-args.hh"
#include "derivations.hh" #include "nix/derivations.hh"
#include "eval-inline.hh" #include "nix/eval-inline.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "eval-settings.hh" #include "nix/eval-settings.hh"
#include "get-drvs.hh" #include "nix/get-drvs.hh"
#include "store-api.hh" #include "nix/store-api.hh"
#include "shared.hh" #include "nix/shared.hh"
#include "flake/flake.hh" #include "nix/flake/flake.hh"
#include "eval-cache.hh" #include "nix/eval-cache.hh"
#include "url.hh" #include "nix/url.hh"
#include "registry.hh" #include "nix/registry.hh"
#include "build-result.hh" #include "nix/build-result.hh"
#include <regex> #include <regex>
#include <queue> #include <queue>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "strings-inline.hh" #include "nix/strings-inline.hh"
namespace nix { namespace nix {

View file

@ -1,4 +1,4 @@
#include "legacy.hh" #include "nix/legacy.hh"
namespace nix { namespace nix {

View file

@ -1,8 +1,10 @@
#include "markdown.hh" #include "nix/markdown.hh"
#include "environment-variables.hh" #include "nix/environment-variables.hh"
#include "error.hh" #include "nix/error.hh"
#include "finally.hh" #include "nix/finally.hh"
#include "terminal.hh" #include "nix/terminal.hh"
#include "cmd-config-private.hh"
#if HAVE_LOWDOWN #if HAVE_LOWDOWN
# include <sys/queue.h> # include <sys/queue.h>

View file

@ -44,28 +44,18 @@ if readline_flavor == 'editline'
elif readline_flavor == 'readline' elif readline_flavor == 'readline'
readline = dependency('readline') readline = dependency('readline')
deps_private += readline deps_private += readline
configdata.set(
'USE_READLINE',
1,
description: 'Use readline instead of editline',
)
else else
error('illegal editline flavor', readline_flavor) error('illegal editline flavor', readline_flavor)
endif endif
configdata.set(
config_h = configure_file( 'USE_READLINE',
configuration : configdata, (readline_flavor == 'readline').to_int(),
output : 'config-cmd.hh', description: 'Use readline instead of editline',
) )
add_project_arguments( config_priv_h = configure_file(
# TODO(Qyriad): Yes this is how the autoconf+Make system did it. configuration : configdata,
# It would be nice for our headers to be idempotent instead. output : 'cmd-config-private.hh',
'-include', 'config-util.hh',
'-include', 'config-store.hh',
'-include', 'config-expr.hh',
'-include', 'config-cmd.hh',
language : 'cpp',
) )
subdir('nix-meson-build-support/common') subdir('nix-meson-build-support/common')
@ -89,27 +79,7 @@ sources = files(
'repl.cc', 'repl.cc',
) )
include_dirs = [include_directories('.')] subdir('include/nix')
headers = files(
'built-path.hh',
'command-installable-value.hh',
'command.hh',
'common-eval-args.hh',
'compatibility-settings.hh',
'editor-for.hh',
'installable-attr-path.hh',
'installable-derived-path.hh',
'installable-flake.hh',
'installable-value.hh',
'installables.hh',
'legacy.hh',
'markdown.hh',
'misc-store-flags.hh',
'network-proxy.hh',
'repl-interacter.hh',
'repl.hh',
)
subdir('nix-meson-build-support/export-all-symbols') subdir('nix-meson-build-support/export-all-symbols')
subdir('nix-meson-build-support/windows-version') subdir('nix-meson-build-support/windows-version')
@ -117,7 +87,7 @@ subdir('nix-meson-build-support/windows-version')
this_library = library( this_library = library(
'nixcmd', 'nixcmd',
sources, sources,
config_h, config_priv_h,
dependencies : deps_public + deps_private + deps_other, dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
link_args: linker_export_flags, link_args: linker_export_flags,

View file

@ -1,4 +1,4 @@
#include "misc-store-flags.hh" #include "nix/misc-store-flags.hh"
namespace nix::flag namespace nix::flag
{ {

View file

@ -1,8 +1,8 @@
#include "network-proxy.hh" #include "nix/network-proxy.hh"
#include <algorithm> #include <algorithm>
#include "environment-variables.hh" #include "nix/environment-variables.hh"
namespace nix { namespace nix {

View file

@ -46,6 +46,7 @@ mkMesonLibrary (finalAttrs: {
./.version ./.version
./meson.build ./meson.build
./meson.options ./meson.options
./include/nix/meson.build
(fileset.fileFilter (file: file.hasExt "cc") ./.) (fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.) (fileset.fileFilter (file: file.hasExt "hh") ./.)
]; ];

View file

@ -1,6 +1,8 @@
#include "cmd-config-private.hh"
#include <cstdio> #include <cstdio>
#ifdef USE_READLINE #if USE_READLINE
#include <readline/history.h> #include <readline/history.h>
#include <readline/readline.h> #include <readline/readline.h>
#else #else
@ -14,12 +16,12 @@ extern "C" {
} }
#endif #endif
#include "signals.hh" #include "nix/signals.hh"
#include "finally.hh" #include "nix/finally.hh"
#include "repl-interacter.hh" #include "nix/repl-interacter.hh"
#include "file-system.hh" #include "nix/file-system.hh"
#include "repl.hh" #include "nix/repl.hh"
#include "environment-variables.hh" #include "nix/environment-variables.hh"
namespace nix { namespace nix {
@ -35,7 +37,7 @@ void sigintHandler(int signo)
static detail::ReplCompleterMixin * curRepl; // ugly static detail::ReplCompleterMixin * curRepl; // ugly
#ifndef USE_READLINE #if !USE_READLINE
static char * completionCallback(char * s, int * match) static char * completionCallback(char * s, int * match)
{ {
auto possible = curRepl->completePrefix(s); auto possible = curRepl->completePrefix(s);
@ -113,14 +115,14 @@ ReadlineLikeInteracter::Guard ReadlineLikeInteracter::init(detail::ReplCompleter
} catch (SystemError & e) { } catch (SystemError & e) {
logWarning(e.info()); logWarning(e.info());
} }
#ifndef USE_READLINE #if !USE_READLINE
el_hist_size = 1000; el_hist_size = 1000;
#endif #endif
read_history(historyFile.c_str()); read_history(historyFile.c_str());
auto oldRepl = curRepl; auto oldRepl = curRepl;
curRepl = repl; curRepl = repl;
Guard restoreRepl([oldRepl] { curRepl = oldRepl; }); Guard restoreRepl([oldRepl] { curRepl = oldRepl; });
#ifndef USE_READLINE #if !USE_READLINE
rl_set_complete_func(completionCallback); rl_set_complete_func(completionCallback);
rl_set_list_possib_func(listPossibleCallback); rl_set_list_possib_func(listPossibleCallback);
#endif #endif
@ -183,7 +185,7 @@ bool ReadlineLikeInteracter::getLine(std::string & input, ReplPromptType promptT
// quite useful for reading the test output, so we add it here. // quite useful for reading the test output, so we add it here.
if (auto e = getEnv("_NIX_TEST_REPL_ECHO"); s && e && *e == "1") if (auto e = getEnv("_NIX_TEST_REPL_ECHO"); s && e && *e == "1")
{ {
#ifndef USE_READLINE #if !USE_READLINE
// This is probably not right for multi-line input, but we don't use that // This is probably not right for multi-line input, but we don't use that
// in the characterisation tests, so it's fine. // in the characterisation tests, so it's fine.
std::cout << promptForType(promptType) << s << std::endl; std::cout << promptForType(promptType) << s << std::endl;

View file

@ -2,34 +2,34 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include "error.hh" #include "nix/error.hh"
#include "repl-interacter.hh" #include "nix/repl-interacter.hh"
#include "repl.hh" #include "nix/repl.hh"
#include "ansicolor.hh" #include "nix/ansicolor.hh"
#include "shared.hh" #include "nix/shared.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "eval-settings.hh" #include "nix/eval-settings.hh"
#include "attr-path.hh" #include "nix/attr-path.hh"
#include "signals.hh" #include "nix/signals.hh"
#include "store-api.hh" #include "nix/store-api.hh"
#include "log-store.hh" #include "nix/log-store.hh"
#include "common-eval-args.hh" #include "nix/common-eval-args.hh"
#include "get-drvs.hh" #include "nix/get-drvs.hh"
#include "derivations.hh" #include "nix/derivations.hh"
#include "globals.hh" #include "nix/globals.hh"
#include "flake/flake.hh" #include "nix/flake/flake.hh"
#include "flake/lockfile.hh" #include "nix/flake/lockfile.hh"
#include "users.hh" #include "nix/users.hh"
#include "editor-for.hh" #include "nix/editor-for.hh"
#include "finally.hh" #include "nix/finally.hh"
#include "markdown.hh" #include "nix/markdown.hh"
#include "local-fs-store.hh" #include "nix/local-fs-store.hh"
#include "print.hh" #include "nix/print.hh"
#include "ref.hh" #include "nix/ref.hh"
#include "value.hh" #include "nix/value.hh"
#include "strings.hh" #include "nix/strings.hh"
namespace nix { namespace nix {

View file

@ -25,18 +25,6 @@ deps_public_maybe_subproject = [
] ]
subdir('nix-meson-build-support/subprojects') subdir('nix-meson-build-support/subprojects')
add_project_arguments(
# TODO(Qyriad): Yes this is how the autoconf+Make system did it.
# 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',
language : 'cpp',
)
subdir('nix-meson-build-support/common') subdir('nix-meson-build-support/common')
sources = files( sources = files(
@ -69,7 +57,7 @@ this_library = library(
install : true, install : true,
) )
install_headers(headers, subdir : 'nix', preserve_path : true) install_headers(headers, preserve_path : true)
libraries_private = [] libraries_private = []

View file

@ -2,11 +2,11 @@
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
#include "eval.hh" #include "nix/eval.hh"
#include "eval-gc.hh" #include "nix/eval-gc.hh"
#include "globals.hh" #include "nix/globals.hh"
#include "eval-settings.hh" #include "nix/eval-settings.hh"
#include "ref.hh" #include "nix/ref.hh"
#include "nix_api_expr.h" #include "nix_api_expr.h"
#include "nix_api_expr_internal.h" #include "nix_api_expr_internal.h"
@ -15,7 +15,7 @@
#include "nix_api_util.h" #include "nix_api_util.h"
#include "nix_api_util_internal.h" #include "nix_api_util_internal.h"
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
# include <mutex> # include <mutex>
#endif #endif
@ -209,7 +209,7 @@ void nix_state_free(EvalState * state)
delete state; delete state;
} }
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
std::unordered_map< std::unordered_map<
const void *, const void *,
unsigned int, unsigned int,
@ -285,7 +285,7 @@ nix_err nix_value_decref(nix_c_context * context, nix_value *x)
void nix_gc_register_finalizer(void * obj, void * cd, void (*finalizer)(void * obj, void * cd)) void nix_gc_register_finalizer(void * obj, void * cd, void (*finalizer)(void * obj, void * cd))
{ {
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
GC_REGISTER_FINALIZER(obj, finalizer, cd, 0, 0); GC_REGISTER_FINALIZER(obj, finalizer, cd, 0, 0);
#endif #endif
} }

View file

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

View file

@ -1,8 +1,8 @@
#include "attr-set.hh" #include "nix/attr-set.hh"
#include "config.hh" #include "nix/config.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "globals.hh" #include "nix/globals.hh"
#include "value.hh" #include "nix/value.hh"
#include "nix_api_expr.h" #include "nix_api_expr.h"
#include "nix_api_expr_internal.h" #include "nix_api_expr_internal.h"
@ -10,7 +10,7 @@
#include "nix_api_util.h" #include "nix_api_util.h"
#include "nix_api_util_internal.h" #include "nix_api_util_internal.h"
#include "nix_api_value.h" #include "nix_api_value.h"
#include "value/context.hh" #include "nix/value/context.hh"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
@ -168,7 +168,7 @@ ExternalValue * nix_create_external_value(nix_c_context * context, NixCExternalV
context->last_err_code = NIX_OK; context->last_err_code = NIX_OK;
try { try {
auto ret = new auto ret = new
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
(GC) (GC)
#endif #endif
NixCExternalValue(*desc, v); NixCExternalValue(*desc, v);

View file

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

View file

@ -1,10 +1,10 @@
#include "attr-set.hh" #include "nix/attr-set.hh"
#include "config.hh" #include "nix/config.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "globals.hh" #include "nix/globals.hh"
#include "path.hh" #include "nix/path.hh"
#include "primops.hh" #include "nix/primops.hh"
#include "value.hh" #include "nix/value.hh"
#include "nix_api_expr.h" #include "nix_api_expr.h"
#include "nix_api_expr_internal.h" #include "nix_api_expr_internal.h"
@ -12,7 +12,7 @@
#include "nix_api_util_internal.h" #include "nix_api_util_internal.h"
#include "nix_api_store_internal.h" #include "nix_api_store_internal.h"
#include "nix_api_value.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 // Internal helper functions to check [in] and [out] `Value *` parameters
static const nix::Value & check_value_not_null(const nix_value * value) static const nix::Value & check_value_not_null(const nix_value * value)
@ -125,7 +125,7 @@ PrimOp * nix_alloc_primop(
try { try {
using namespace std::placeholders; using namespace std::placeholders;
auto p = new auto p = new
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
(GC) (GC)
#endif #endif
nix::PrimOp{ nix::PrimOp{
@ -497,7 +497,7 @@ ListBuilder * nix_make_list_builder(nix_c_context * context, EvalState * state,
try { try {
auto builder = state->state.buildList(capacity); auto builder = state->state.buildList(capacity);
return new return new
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
(NoGC) (NoGC)
#endif #endif
ListBuilder{std::move(builder)}; ListBuilder{std::move(builder)};
@ -519,7 +519,7 @@ nix_list_builder_insert(nix_c_context * context, ListBuilder * list_builder, uns
void nix_list_builder_free(ListBuilder * list_builder) void nix_list_builder_free(ListBuilder * list_builder)
{ {
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
GC_FREE(list_builder); GC_FREE(list_builder);
#else #else
delete list_builder; delete list_builder;
@ -578,7 +578,7 @@ BindingsBuilder * nix_make_bindings_builder(nix_c_context * context, EvalState *
try { try {
auto bb = state->state.buildBindings(capacity); auto bb = state->state.buildBindings(capacity);
return new return new
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
(NoGC) (NoGC)
#endif #endif
BindingsBuilder{std::move(bb)}; BindingsBuilder{std::move(bb)};
@ -600,7 +600,7 @@ nix_err nix_bindings_builder_insert(nix_c_context * context, BindingsBuilder * b
void nix_bindings_builder_free(BindingsBuilder * bb) void nix_bindings_builder_free(BindingsBuilder * bb)
{ {
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
GC_FREE((nix::BindingsBuilder *) bb); GC_FREE((nix::BindingsBuilder *) bb);
#else #else
delete (nix::BindingsBuilder *) bb; delete (nix::BindingsBuilder *) bb;

View file

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

View file

@ -0,0 +1,9 @@
# Public headers directory
include_dirs = [include_directories('..')]
headers = files(
'tests/libexpr.hh',
'tests/nix_api_expr.hh',
'tests/value/context.hh',
)

View file

@ -4,16 +4,16 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include "fetch-settings.hh" #include "nix/fetch-settings.hh"
#include "value.hh" #include "nix/value.hh"
#include "nixexpr.hh" #include "nix/nixexpr.hh"
#include "nixexpr.hh" #include "nix/nixexpr.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "eval-gc.hh" #include "nix/eval-gc.hh"
#include "eval-inline.hh" #include "nix/eval-inline.hh"
#include "eval-settings.hh" #include "nix/eval-settings.hh"
#include "tests/libstore.hh" #include "nix/tests/libstore.hh"
namespace nix { namespace nix {
class LibExprTest : public LibStoreTest { class LibExprTest : public LibStoreTest {

View file

@ -2,7 +2,7 @@
///@file ///@file
#include "nix_api_expr.h" #include "nix_api_expr.h"
#include "nix_api_value.h" #include "nix_api_value.h"
#include "tests/nix_api_store.hh" #include "nix/tests/nix_api_store.hh"
#include <gtest/gtest.h> #include <gtest/gtest.h>

View file

@ -3,7 +3,7 @@
#include <rapidcheck/gen/Arbitrary.h> #include <rapidcheck/gen/Arbitrary.h>
#include "value/context.hh" #include "nix/value/context.hh"
namespace rc { namespace rc {
using namespace nix; using namespace nix;

View file

@ -29,28 +29,13 @@ subdir('nix-meson-build-support/subprojects')
rapidcheck = dependency('rapidcheck') rapidcheck = dependency('rapidcheck')
deps_public += rapidcheck deps_public += rapidcheck
add_project_arguments(
# TODO(Qyriad): Yes this is how the autoconf+Make system did it.
# It would be nice for our headers to be idempotent instead.
'-include', 'config-util.hh',
'-include', 'config-store.hh',
'-include', 'config-expr.hh',
language : 'cpp',
)
subdir('nix-meson-build-support/common') subdir('nix-meson-build-support/common')
sources = files( sources = files(
'tests/value/context.cc', 'tests/value/context.cc',
) )
include_dirs = [include_directories('.')] subdir('include/nix')
headers = files(
'tests/libexpr.hh',
'tests/nix_api_expr.hh',
'tests/value/context.hh',
)
subdir('nix-meson-build-support/export-all-symbols') subdir('nix-meson-build-support/export-all-symbols')
subdir('nix-meson-build-support/windows-version') subdir('nix-meson-build-support/windows-version')

View file

@ -29,6 +29,7 @@ mkMesonLibrary (finalAttrs: {
./.version ./.version
./meson.build ./meson.build
# ./meson.options # ./meson.options
./include/nix/meson.build
(fileset.fileFilter (file: file.hasExt "cc") ./.) (fileset.fileFilter (file: file.hasExt "cc") ./.)
(fileset.fileFilter (file: file.hasExt "hh") ./.) (fileset.fileFilter (file: file.hasExt "hh") ./.)
]; ];

View file

@ -1,7 +1,7 @@
#include <rapidcheck.h> #include <rapidcheck.h>
#include "tests/path.hh" #include "nix/tests/path.hh"
#include "tests/value/context.hh" #include "nix/tests/value/context.hh"
namespace rc { namespace rc {
using namespace nix; using namespace nix;

View file

@ -2,8 +2,8 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <rapidcheck/gtest.h> #include <rapidcheck/gtest.h>
#include "tests/derived-path.hh" #include "nix/tests/derived-path.hh"
#include "tests/libexpr.hh" #include "nix/tests/libexpr.hh"
namespace nix { namespace nix {

View file

@ -1,7 +1,7 @@
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "tests/libexpr.hh" #include "nix/tests/libexpr.hh"
namespace nix { namespace nix {

View file

@ -1,8 +1,8 @@
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "eval.hh" #include "nix/eval.hh"
#include "tests/libexpr.hh" #include "nix/tests/libexpr.hh"
namespace nix { namespace nix {

View file

@ -1,5 +1,5 @@
#include "tests/libexpr.hh" #include "nix/tests/libexpr.hh"
#include "value-to-json.hh" #include "nix/value-to-json.hh"
namespace nix { namespace nix {
// Testing the conversion to JSON // Testing the conversion to JSON

View file

@ -1,7 +1,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <cstdlib> #include <cstdlib>
#include "globals.hh" #include "nix/globals.hh"
#include "logging.hh" #include "nix/logging.hh"
using namespace nix; using namespace nix;

View file

@ -35,13 +35,12 @@ deps_private += gtest
gtest = dependency('gmock') gtest = dependency('gmock')
deps_private += gtest deps_private += gtest
add_project_arguments( configdata = configuration_data()
# TODO(Qyriad): Yes this is how the autoconf+Make system did it. configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
# It would be nice for our headers to be idempotent instead.
'-include', 'config-util.hh', config_priv_h = configure_file(
'-include', 'config-store.hh', configuration : configdata,
'-include', 'config-expr.hh', output : 'expr-tests-config.hh',
language : 'cpp',
) )
subdir('nix-meson-build-support/common') subdir('nix-meson-build-support/common')
@ -69,6 +68,7 @@ include_dirs = [include_directories('.')]
this_exe = executable( this_exe = executable(
meson.project_name(), meson.project_name(),
sources, sources,
config_priv_h,
dependencies : deps_private_subproject + deps_private + deps_other, dependencies : deps_private_subproject + deps_private + deps_other,
include_directories : include_dirs, include_directories : include_dirs,
# TODO: -lrapidcheck, see ../libutil-support/build.meson # TODO: -lrapidcheck, see ../libutil-support/build.meson

View file

@ -5,13 +5,15 @@
#include "nix_api_expr.h" #include "nix_api_expr.h"
#include "nix_api_value.h" #include "nix_api_value.h"
#include "tests/nix_api_expr.hh" #include "nix/tests/nix_api_expr.hh"
#include "tests/string_callback.hh" #include "nix/tests/string_callback.hh"
#include "file-system.hh" #include "nix/file-system.hh"
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "expr-tests-config.hh"
namespace nixC { namespace nixC {
TEST_F(nix_api_store_test, nix_eval_state_lookup_path) TEST_F(nix_api_store_test, nix_eval_state_lookup_path)

View file

@ -7,8 +7,8 @@
#include "nix_api_value.h" #include "nix_api_value.h"
#include "nix_api_external.h" #include "nix_api_external.h"
#include "tests/nix_api_expr.hh" #include "nix/tests/nix_api_expr.hh"
#include "tests/string_callback.hh" #include "nix/tests/string_callback.hh"
#include <gtest/gtest.h> #include <gtest/gtest.h>

View file

@ -6,10 +6,10 @@
#include "nix_api_value.h" #include "nix_api_value.h"
#include "nix_api_expr_internal.h" #include "nix_api_expr_internal.h"
#include "tests/nix_api_expr.hh" #include "nix/tests/nix_api_expr.hh"
#include "tests/string_callback.hh" #include "nix/tests/string_callback.hh"
#include "gmock/gmock.h" #include <gmock/gmock.h>
#include <cstddef> #include <cstddef>
#include <cstdlib> #include <cstdlib>
#include <gtest/gtest.h> #include <gtest/gtest.h>

View file

@ -1,10 +1,10 @@
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "eval-settings.hh" #include "nix/eval-settings.hh"
#include "memory-source-accessor.hh" #include "nix/memory-source-accessor.hh"
#include "tests/libexpr.hh" #include "nix/tests/libexpr.hh"
namespace nix { namespace nix {
class CaptureLogger : public Logger class CaptureLogger : public Logger

View file

@ -1,7 +1,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gmock/gmock.h> #include <gmock/gmock.h>
#include "search-path.hh" #include "nix/search-path.hh"
namespace nix { namespace nix {

View file

@ -1,4 +1,4 @@
#include "tests/libexpr.hh" #include "nix/tests/libexpr.hh"
namespace nix { namespace nix {
// Testing of trivial expressions // Testing of trivial expressions

View file

@ -2,9 +2,9 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <rapidcheck/gtest.h> #include <rapidcheck/gtest.h>
#include "tests/path.hh" #include "nix/tests/path.hh"
#include "tests/libexpr.hh" #include "nix/tests/libexpr.hh"
#include "tests/value/context.hh" #include "nix/tests/value/context.hh"
namespace nix { namespace nix {

View file

@ -1,7 +1,7 @@
#include "tests/libexpr.hh" #include "nix/tests/libexpr.hh"
#include "value.hh" #include "nix/value.hh"
#include "print.hh" #include "nix/print.hh"
namespace nix { namespace nix {

View file

@ -1,6 +1,6 @@
#include "value.hh" #include "nix/value.hh"
#include "tests/libstore.hh" #include "nix/tests/libstore.hh"
namespace nix { namespace nix {

View file

@ -1,5 +1,5 @@
#include "attr-path.hh" #include "nix/attr-path.hh"
#include "eval-inline.hh" #include "nix/eval-inline.hh"
namespace nix { namespace nix {

View file

@ -1,5 +1,5 @@
#include "attr-set.hh" #include "nix/attr-set.hh"
#include "eval-inline.hh" #include "nix/eval-inline.hh"
#include <algorithm> #include <algorithm>

View file

@ -1,11 +1,11 @@
#include "users.hh" #include "nix/users.hh"
#include "eval-cache.hh" #include "nix/eval-cache.hh"
#include "sqlite.hh" #include "nix/sqlite.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "eval-inline.hh" #include "nix/eval-inline.hh"
#include "store-api.hh" #include "nix/store-api.hh"
// Need specialization involving `SymbolStr` just in this one module. // Need specialization involving `SymbolStr` just in this one module.
#include "strings-inline.hh" #include "nix/strings-inline.hh"
namespace nix::eval_cache { namespace nix::eval_cache {

View file

@ -1,6 +1,6 @@
#include "eval-error.hh" #include "nix/eval-error.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "value.hh" #include "nix/value.hh"
namespace nix { namespace nix {

View file

@ -1,11 +1,13 @@
#include "error.hh" #include "nix/error.hh"
#include "environment-variables.hh" #include "nix/environment-variables.hh"
#include "eval-settings.hh" #include "nix/eval-settings.hh"
#include "config-global.hh" #include "nix/config-global.hh"
#include "serialise.hh" #include "nix/serialise.hh"
#include "eval-gc.hh" #include "nix/eval-gc.hh"
#if HAVE_BOEHMGC #include "expr-config-private.hh"
#if NIX_USE_BOEHMGC
# include <pthread.h> # include <pthread.h>
# if __FreeBSD__ # if __FreeBSD__
@ -24,7 +26,7 @@
namespace nix { namespace nix {
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
/* Called when the Boehm GC runs out of memory. */ /* Called when the Boehm GC runs out of memory. */
static void * oomHandler(size_t requested) static void * oomHandler(size_t requested)
{ {
@ -94,7 +96,7 @@ void initGC()
if (gcInitialised) if (gcInitialised)
return; return;
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
initGCReal(); initGCReal();
gcCyclesAfterInit = GC_get_gc_no(); gcCyclesAfterInit = GC_get_gc_no();

View file

@ -1,8 +1,8 @@
#include "users.hh" #include "nix/users.hh"
#include "globals.hh" #include "nix/globals.hh"
#include "profiles.hh" #include "nix/profiles.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "eval-settings.hh" #include "nix/eval-settings.hh"
namespace nix { namespace nix {

View file

@ -1,24 +1,25 @@
#include "eval.hh" #include "nix/eval.hh"
#include "eval-settings.hh" #include "nix/eval-settings.hh"
#include "primops.hh" #include "nix/primops.hh"
#include "print-options.hh" #include "nix/print-options.hh"
#include "exit.hh" #include "nix/exit.hh"
#include "types.hh" #include "nix/types.hh"
#include "util.hh" #include "nix/util.hh"
#include "store-api.hh" #include "nix/store-api.hh"
#include "derivations.hh" #include "nix/derivations.hh"
#include "downstream-placeholder.hh" #include "nix/downstream-placeholder.hh"
#include "eval-inline.hh" #include "nix/eval-inline.hh"
#include "filetransfer.hh" #include "nix/filetransfer.hh"
#include "function-trace.hh" #include "nix/function-trace.hh"
#include "profiles.hh" #include "nix/profiles.hh"
#include "print.hh" #include "nix/print.hh"
#include "filtering-source-accessor.hh" #include "nix/filtering-source-accessor.hh"
#include "memory-source-accessor.hh" #include "nix/memory-source-accessor.hh"
#include "gc-small-vector.hh" #include "nix/gc-small-vector.hh"
#include "url.hh" #include "nix/url.hh"
#include "fetch-to-store.hh" #include "nix/fetch-to-store.hh"
#include "tarball.hh" #include "nix/tarball.hh"
#include "parser-tab.hh" #include "parser-tab.hh"
#include <algorithm> #include <algorithm>
@ -38,7 +39,7 @@
# include <sys/resource.h> # include <sys/resource.h>
#endif #endif
#include "strings-inline.hh" #include "nix/strings-inline.hh"
using json = nlohmann::json; using json = nlohmann::json;
@ -294,7 +295,7 @@ EvalState::EvalState(
, debugStop(false) , debugStop(false)
, trylevel(0) , trylevel(0)
, regexCache(makeRegexCache()) , regexCache(makeRegexCache())
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
, valueAllocCache(std::allocate_shared<void *>(traceable_allocator<void *>(), nullptr)) , valueAllocCache(std::allocate_shared<void *>(traceable_allocator<void *>(), nullptr))
, env1AllocCache(std::allocate_shared<void *>(traceable_allocator<void *>(), nullptr)) , env1AllocCache(std::allocate_shared<void *>(traceable_allocator<void *>(), nullptr))
, baseEnvP(std::allocate_shared<Env *>(traceable_allocator<Env *>(), &allocEnv(BASE_ENV_SIZE))) , baseEnvP(std::allocate_shared<Env *>(traceable_allocator<Env *>(), &allocEnv(BASE_ENV_SIZE)))
@ -2811,7 +2812,7 @@ bool EvalState::eqValues(Value & v1, Value & v2, const PosIdx pos, std::string_v
} }
bool EvalState::fullGC() { bool EvalState::fullGC() {
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
GC_gcollect(); GC_gcollect();
// Check that it ran. We might replace this with a version that uses more // Check that it ran. We might replace this with a version that uses more
// of the boehm API to get this reliably, at a maintenance cost. // of the boehm API to get this reliably, at a maintenance cost.
@ -2830,7 +2831,7 @@ void EvalState::maybePrintStats()
if (showStats) { if (showStats) {
// Make the final heap size more deterministic. // Make the final heap size more deterministic.
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
if (!fullGC()) { if (!fullGC()) {
warn("failed to perform a full GC before reporting stats"); warn("failed to perform a full GC before reporting stats");
} }
@ -2852,7 +2853,7 @@ void EvalState::printStatistics()
uint64_t bValues = nrValues * sizeof(Value); uint64_t bValues = nrValues * sizeof(Value);
uint64_t bAttrsets = nrAttrsets * sizeof(Bindings) + nrAttrsInAttrsets * sizeof(Attr); uint64_t bAttrsets = nrAttrsets * sizeof(Bindings) + nrAttrsInAttrsets * sizeof(Attr);
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
GC_word heapSize, totalBytes; GC_word heapSize, totalBytes;
GC_get_heap_usage_safe(&heapSize, 0, 0, 0, &totalBytes); GC_get_heap_usage_safe(&heapSize, 0, 0, 0, &totalBytes);
double gcFullOnlyTime = ({ double gcFullOnlyTime = ({
@ -2874,7 +2875,7 @@ void EvalState::printStatistics()
#ifndef _WIN32 // TODO implement #ifndef _WIN32 // TODO implement
{"cpu", cpuTime}, {"cpu", cpuTime},
#endif #endif
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
{GC_is_incremental_mode() ? "gcNonIncremental" : "gc", gcFullOnlyTime}, {GC_is_incremental_mode() ? "gcNonIncremental" : "gc", gcFullOnlyTime},
#ifndef _WIN32 // TODO implement #ifndef _WIN32 // TODO implement
{GC_is_incremental_mode() ? "gcNonIncrementalFraction" : "gcFraction", gcFullOnlyTime / cpuTime}, {GC_is_incremental_mode() ? "gcNonIncrementalFraction" : "gcFraction", gcFullOnlyTime / cpuTime},
@ -2918,7 +2919,7 @@ void EvalState::printStatistics()
topObj["nrLookups"] = nrLookups; topObj["nrLookups"] = nrLookups;
topObj["nrPrimOpCalls"] = nrPrimOpCalls; topObj["nrPrimOpCalls"] = nrPrimOpCalls;
topObj["nrFunctionCalls"] = nrFunctionCalls; topObj["nrFunctionCalls"] = nrFunctionCalls;
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
topObj["gc"] = { topObj["gc"] = {
{"heapSize", heapSize}, {"heapSize", heapSize},
{"totalBytes", totalBytes}, {"totalBytes", totalBytes},

View file

@ -1,5 +1,5 @@
#include "function-trace.hh" #include "nix/function-trace.hh"
#include "logging.hh" #include "nix/logging.hh"
namespace nix { namespace nix {

View file

@ -1,8 +1,8 @@
#include "get-drvs.hh" #include "nix/get-drvs.hh"
#include "eval-inline.hh" #include "nix/eval-inline.hh"
#include "derivations.hh" #include "nix/derivations.hh"
#include "store-api.hh" #include "nix/store-api.hh"
#include "path-with-outputs.hh" #include "nix/path-with-outputs.hh"
#include <cstring> #include <cstring>
#include <regex> #include <regex>

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
///@file ///@file
#include "eval.hh" #include "nix/eval.hh"
#include <string> #include <string>
#include <map> #include <map>

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
///@file ///@file
#include "nixexpr.hh" #include "nix/nixexpr.hh"
#include "symbol-table.hh" #include "nix/symbol-table.hh"
#include <algorithm> #include <algorithm>

View file

@ -1,9 +1,9 @@
#pragma once #pragma once
///@file ///@file
#include "sync.hh" #include "nix/sync.hh"
#include "hash.hh" #include "nix/hash.hh"
#include "eval.hh" #include "nix/eval.hh"
#include <functional> #include <functional>
#include <variant> #include <variant>

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "error.hh" #include "nix/error.hh"
#include "pos-idx.hh" #include "nix/pos-idx.hh"
namespace nix { namespace nix {

View file

@ -3,7 +3,10 @@
#include <cstddef> #include <cstddef>
#if HAVE_BOEHMGC // For `NIX_USE_BOEHMGC`, and if that's set, `GC_THREADS`
#include "nix/expr-config.hh"
#if NIX_USE_BOEHMGC
# define GC_INCLUDE_NEW # define GC_INCLUDE_NEW
@ -43,7 +46,7 @@ void initGC();
*/ */
void assertGCInitialized(); void assertGCInitialized();
#ifdef HAVE_BOEHMGC #if NIX_USE_BOEHMGC
/** /**
* The number of GC cycles since initGC(). * The number of GC cycles since initGC().
*/ */

View file

@ -1,10 +1,13 @@
#pragma once #pragma once
///@file ///@file
#include "print.hh" #include "nix/print.hh"
#include "eval.hh" #include "nix/eval.hh"
#include "eval-error.hh" #include "nix/eval-error.hh"
#include "eval-settings.hh" #include "nix/eval-settings.hh"
// For `NIX_USE_BOEHMGC`, and if that's set, `GC_THREADS`
#include "nix/expr-config.hh"
namespace nix { namespace nix {
@ -15,7 +18,7 @@ namespace nix {
inline void * allocBytes(size_t n) inline void * allocBytes(size_t n)
{ {
void * p; void * p;
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
p = GC_MALLOC(n); p = GC_MALLOC(n);
#else #else
p = calloc(n, 1); p = calloc(n, 1);
@ -28,7 +31,7 @@ inline void * allocBytes(size_t n)
[[gnu::always_inline]] [[gnu::always_inline]]
Value * EvalState::allocValue() Value * EvalState::allocValue()
{ {
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
/* We use the boehm batch allocator to speed up allocations of Values (of which there are many). /* We use the boehm batch allocator to speed up allocations of Values (of which there are many).
GC_malloc_many returns a linked list of objects of the given size, where the first word GC_malloc_many returns a linked list of objects of the given size, where the first word
of each object is also the pointer to the next object in the list. This also means that we of each object is also the pointer to the next object in the list. This also means that we
@ -60,7 +63,7 @@ Env & EvalState::allocEnv(size_t size)
Env * env; Env * env;
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
if (size == 1) { if (size == 1) {
/* see allocValue for explanations. */ /* see allocValue for explanations. */
if (!*env1AllocCache) { if (!*env1AllocCache) {

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
///@file ///@file
#include "config.hh" #include "nix/config.hh"
#include "source-path.hh" #include "nix/source-path.hh"
namespace nix { namespace nix {

View file

@ -1,20 +1,23 @@
#pragma once #pragma once
///@file ///@file
#include "attr-set.hh" #include "nix/attr-set.hh"
#include "eval-error.hh" #include "nix/eval-error.hh"
#include "types.hh" #include "nix/types.hh"
#include "value.hh" #include "nix/value.hh"
#include "nixexpr.hh" #include "nix/nixexpr.hh"
#include "symbol-table.hh" #include "nix/symbol-table.hh"
#include "config.hh" #include "nix/config.hh"
#include "experimental-features.hh" #include "nix/experimental-features.hh"
#include "position.hh" #include "nix/position.hh"
#include "pos-table.hh" #include "nix/pos-table.hh"
#include "source-accessor.hh" #include "nix/source-accessor.hh"
#include "search-path.hh" #include "nix/search-path.hh"
#include "repl-exit-status.hh" #include "nix/repl-exit-status.hh"
#include "ref.hh" #include "nix/ref.hh"
// For `NIX_USE_BOEHMGC`, and if that's set, `GC_THREADS`
#include "nix/expr-config.hh"
#include <map> #include <map>
#include <optional> #include <optional>
@ -369,7 +372,7 @@ private:
*/ */
std::shared_ptr<RegexCache> regexCache; std::shared_ptr<RegexCache> regexCache;
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
/** /**
* Allocation cache for GC'd Value objects. * Allocation cache for GC'd Value objects.
*/ */
@ -596,7 +599,7 @@ public:
*/ */
SingleDerivedPath coerceToSingleDerivedPath(const PosIdx pos, Value & v, std::string_view errorCtx); SingleDerivedPath coerceToSingleDerivedPath(const PosIdx pos, Value & v, std::string_view errorCtx);
#if HAVE_BOEHMGC #if NIX_USE_BOEHMGC
/** A GC root for the baseEnv reference. */ /** A GC root for the baseEnv reference. */
std::shared_ptr<Env *> baseEnvP; std::shared_ptr<Env *> baseEnvP;
#endif #endif
@ -944,4 +947,4 @@ bool isAllowedURI(std::string_view uri, const Strings & allowedPaths);
} }
#include "eval-inline.hh" #include "nix/eval-inline.hh"

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
///@file ///@file
#include "eval.hh" #include "nix/eval.hh"
#include <chrono> #include <chrono>

View file

@ -2,7 +2,7 @@
#include <boost/container/small_vector.hpp> #include <boost/container/small_vector.hpp>
#include "value.hh" #include "nix/value.hh"
namespace nix { namespace nix {

View file

@ -1,8 +1,8 @@
#pragma once #pragma once
///@file ///@file
#include "eval.hh" #include "nix/eval.hh"
#include "path.hh" #include "nix/path.hh"
#include <string> #include <string>
#include <map> #include <map>

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
///@file ///@file
#include "error.hh" #include "nix/error.hh"
#include <string> #include <string>

View file

@ -0,0 +1,37 @@
# Public headers directory
include_dirs = [include_directories('..')]
config_pub_h = configure_file(
configuration : configdata_pub,
output : 'expr-config.hh',
)
headers = [config_pub_h] + files(
'attr-path.hh',
'attr-set.hh',
'eval-cache.hh',
'eval-error.hh',
'eval-gc.hh',
'eval-inline.hh',
'eval-settings.hh',
'eval.hh',
'function-trace.hh',
'gc-small-vector.hh',
'get-drvs.hh',
'json-to-value.hh',
# internal: 'lexer-helpers.hh',
'nixexpr.hh',
'parser-state.hh',
'primops.hh',
'print-ambiguous.hh',
'print-options.hh',
'print.hh',
'repl-exit-status.hh',
'search-path.hh',
'symbol-table.hh',
'value-to-json.hh',
'value-to-xml.hh',
'value.hh',
'value/context.hh',
)

View file

@ -4,10 +4,10 @@
#include <map> #include <map>
#include <vector> #include <vector>
#include "value.hh" #include "nix/value.hh"
#include "symbol-table.hh" #include "nix/symbol-table.hh"
#include "eval-error.hh" #include "nix/eval-error.hh"
#include "pos-idx.hh" #include "nix/pos-idx.hh"
namespace nix { namespace nix {

View file

@ -3,7 +3,7 @@
#include <limits> #include <limits>
#include "eval.hh" #include "nix/eval.hh"
namespace nix { namespace nix {

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
///@file ///@file
#include "eval.hh" #include "nix/eval.hh"
#include <tuple> #include <tuple>
#include <vector> #include <vector>

View file

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "value.hh" #include "nix/value.hh"
namespace nix { namespace nix {

Some files were not shown because too many files have changed in this diff Show more