1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-21 17:59:36 +01:00

Tagging release 2.28.0

-----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCAAxFiEEtUHVUwEnDgvPFcpdgXC0cm1xmN4FAmfv9fITHGVkb2xzdHJh
 QGdtYWlsLmNvbQAKCRCBcLRybXGY3ohrCAC1Uw/JJr3yEPlJ/jLc9t9HqEKMY08W
 W6SEjpYJHYixMXmoonexkqojncNWBaiytRa+vBY7JQq0xTOOBwj42TM2ZzMF4GXi
 vO4Ox0hEsRa/v7tSmK6GFz1sNEKEUOHDNbilg4kzkkBHPEGPUGMwdWkT0akO576Q
 SQ6ERwPPLsHDI2YtAeAD8R4p07CraiyA34ljDPz3rChTAXRPVKWxJUt1enwEWYTr
 cKk45RcR4S8rP1BVwf3wsNsrHjqjbaY45kPAo8GD79hFH0zkyJarS3Kgv8qsWLra
 9ph0DVVG0wiArlET7Y3uchqtAC0Z5LOnutAmOFYFw6DKfWp9yGfl/SVW
 =XRda
 -----END PGP SIGNATURE-----

Merge tag '2.28.0' into sync-2.28.0

Tagging release 2.28.0
This commit is contained in:
Eelco Dolstra 2025-04-04 17:49:15 +02:00
commit 852075ec9d
697 changed files with 4531 additions and 3970 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,12 +1,12 @@
#pragma once
///@file
#include "path.hh"
#include "outputs-spec.hh"
#include "derived-path.hh"
#include "built-path.hh"
#include "store-api.hh"
#include "build-result.hh"
#include "nix/store/path.hh"
#include "nix/store/outputs-spec.hh"
#include "nix/store/derived-path.hh"
#include "nix/cmd/built-path.hh"
#include "nix/store/store-api.hh"
#include "nix/store/build-result.hh"
#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 "content-address.hh"
#include "nix/util/args.hh"
#include "nix/store/content-address.hh"
namespace nix::flag {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -44,30 +44,18 @@ if readline_flavor == 'editline'
elif readline_flavor == 'readline'
readline = dependency('readline')
deps_private += readline
configdata.set(
'USE_READLINE',
1,
description: 'Use readline instead of editline',
)
else
error('illegal editline flavor', readline_flavor)
endif
config_h = configure_file(
configuration : configdata,
output : 'config-cmd.hh',
configdata.set(
'USE_READLINE',
(readline_flavor == 'readline').to_int(),
description: 'Use readline instead of editline',
)
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-fetchers.h',
'-include', 'config-expr.hh',
'-include', 'config-main.hh',
'-include', 'config-cmd.hh',
language : 'cpp',
config_priv_h = configure_file(
configuration : configdata,
output : 'cmd-config-private.hh',
)
subdir('nix-meson-build-support/common')
@ -91,37 +79,23 @@ sources = files(
'repl.cc',
)
include_dirs = [include_directories('.')]
subdir('include/nix/cmd')
headers = [config_h] + 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/windows-version')
this_library = library(
'nixcmd',
sources,
config_priv_h,
dependencies : deps_public + deps_private + deps_other,
include_directories : include_dirs,
link_args: linker_export_flags,
prelink : true, # For C++ static initializers
install : true,
)
install_headers(headers, subdir : 'nix', preserve_path : true)
install_headers(headers, subdir : 'nix/cmd', preserve_path : true)
libraries_private = []

View file

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

View file

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

View file

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

View file

@ -1,6 +1,8 @@
#include "cmd-config-private.hh"
#include <cstdio>
#ifdef USE_READLINE
#if USE_READLINE
#include <readline/history.h>
#include <readline/readline.h>
#else
@ -14,12 +16,12 @@ extern "C" {
}
#endif
#include "signals.hh"
#include "finally.hh"
#include "repl-interacter.hh"
#include "file-system.hh"
#include "repl.hh"
#include "environment-variables.hh"
#include "nix/util/signals.hh"
#include "nix/util/finally.hh"
#include "nix/cmd/repl-interacter.hh"
#include "nix/util/file-system.hh"
#include "nix/cmd/repl.hh"
#include "nix/util/environment-variables.hh"
namespace nix {
@ -35,7 +37,7 @@ void sigintHandler(int signo)
static detail::ReplCompleterMixin * curRepl; // ugly
#ifndef USE_READLINE
#if !USE_READLINE
static char * completionCallback(char * s, int * match)
{
auto possible = curRepl->completePrefix(s);
@ -113,14 +115,14 @@ ReadlineLikeInteracter::Guard ReadlineLikeInteracter::init(detail::ReplCompleter
} catch (SystemError & e) {
logWarning(e.info());
}
#ifndef USE_READLINE
#if !USE_READLINE
el_hist_size = 1000;
#endif
read_history(historyFile.c_str());
auto oldRepl = curRepl;
curRepl = repl;
Guard restoreRepl([oldRepl] { curRepl = oldRepl; });
#ifndef USE_READLINE
#if !USE_READLINE
rl_set_complete_func(completionCallback);
rl_set_list_possib_func(listPossibleCallback);
#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.
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
// in the characterisation tests, so it's fine.
std::cout << promptForType(promptType) << s << std::endl;

View file

@ -2,34 +2,34 @@
#include <cstdlib>
#include <cstring>
#include "error.hh"
#include "repl-interacter.hh"
#include "repl.hh"
#include "nix/util/error.hh"
#include "nix/cmd/repl-interacter.hh"
#include "nix/cmd/repl.hh"
#include "ansicolor.hh"
#include "shared.hh"
#include "eval.hh"
#include "eval-settings.hh"
#include "attr-path.hh"
#include "signals.hh"
#include "store-api.hh"
#include "log-store.hh"
#include "common-eval-args.hh"
#include "get-drvs.hh"
#include "derivations.hh"
#include "globals.hh"
#include "flake/flake.hh"
#include "flake/lockfile.hh"
#include "users.hh"
#include "editor-for.hh"
#include "finally.hh"
#include "markdown.hh"
#include "local-fs-store.hh"
#include "print.hh"
#include "ref.hh"
#include "value.hh"
#include "nix/util/ansicolor.hh"
#include "nix/main/shared.hh"
#include "nix/expr/eval.hh"
#include "nix/expr/eval-settings.hh"
#include "nix/expr/attr-path.hh"
#include "nix/util/signals.hh"
#include "nix/store/store-api.hh"
#include "nix/store/log-store.hh"
#include "nix/cmd/common-eval-args.hh"
#include "nix/expr/get-drvs.hh"
#include "nix/store/derivations.hh"
#include "nix/store/globals.hh"
#include "nix/flake/flake.hh"
#include "nix/flake/lockfile.hh"
#include "nix/util/users.hh"
#include "nix/cmd/editor-for.hh"
#include "nix/util/finally.hh"
#include "nix/cmd/markdown.hh"
#include "nix/store/local-fs-store.hh"
#include "nix/expr/print.hh"
#include "nix/util/ref.hh"
#include "nix/expr/value.hh"
#include "strings.hh"
#include "nix/util/strings.hh"
namespace nix {
@ -124,7 +124,7 @@ std::string removeWhitespace(std::string s)
NixRepl::NixRepl(const LookupPath & lookupPath, nix::ref<Store> store, ref<EvalState> state,
std::function<NixRepl::AnnotatedValues()> getValues, RunNix * runNix = nullptr)
std::function<NixRepl::AnnotatedValues()> getValues, RunNix * runNix)
: AbstractNixRepl(state)
, debugTraceIndex(0)
, getValues(getValues)
@ -839,9 +839,10 @@ std::unique_ptr<AbstractNixRepl> AbstractNixRepl::create(
{
return std::make_unique<NixRepl>(
lookupPath,
openStore(),
std::move(store),
state,
getValues
getValues,
runNix
);
}
@ -859,7 +860,8 @@ ReplExitStatus AbstractNixRepl::runSimple(
lookupPath,
openStore(),
evalState,
getValues
getValues,
/*runNix=*/nullptr
);
repl->initEnv();

View file

@ -14,8 +14,6 @@ cxx = meson.get_compiler('cpp')
subdir('nix-meson-build-support/deps-lists')
configdata = configuration_data()
deps_private_maybe_subproject = [
dependency('nix-util'),
dependency('nix-store'),
@ -27,30 +25,6 @@ deps_public_maybe_subproject = [
]
subdir('nix-meson-build-support/subprojects')
# TODO rename, because it will conflict with downstream projects
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h = configure_file(
configuration : configdata,
output : 'config-expr.h',
)
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',
# From C libraries, for our public, installed headers too
'-include', 'config-util.h',
'-include', 'config-store.h',
'-include', 'config-expr.h',
language : 'cpp',
)
subdir('nix-meson-build-support/common')
sources = files(
@ -61,7 +35,7 @@ sources = files(
include_dirs = [include_directories('.')]
headers = [config_h] + files(
headers = files(
'nix_api_expr.h',
'nix_api_external.h',
'nix_api_value.h',
@ -83,7 +57,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/expr/eval.hh"
#include "nix/expr/eval-gc.hh"
#include "nix/store/globals.hh"
#include "nix/expr/eval-settings.hh"
#include "nix/util/ref.hh"
#include "nix_api_expr.h"
#include "nix_api_expr_internal.h"
@ -15,7 +15,7 @@
#include "nix_api_util.h"
#include "nix_api_util_internal.h"
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
# include <mutex>
#endif
@ -207,7 +207,7 @@ void nix_state_free(EvalState * state)
delete state;
}
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
std::unordered_map<
const void *,
unsigned int,
@ -283,7 +283,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))
{
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
GC_REGISTER_FINALIZER(obj, finalizer, cd, 0, 0);
#endif
}

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/fetchers/fetch-settings.hh"
#include "nix/expr/eval.hh"
#include "nix/expr/eval-settings.hh"
#include "nix/expr/attr-set.hh"
#include "nix_api_value.h"
#include "search-path.hh"
#include "nix/expr/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/expr/attr-set.hh"
#include "nix/util/configuration.hh"
#include "nix/expr/eval.hh"
#include "nix/store/globals.hh"
#include "nix/expr/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/expr/value/context.hh"
#include <nlohmann/json.hpp>
@ -168,7 +168,7 @@ ExternalValue * nix_create_external_value(nix_c_context * context, NixCExternalV
context->last_err_code = NIX_OK;
try {
auto ret = new
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
(GC)
#endif
NixCExternalValue(*desc, v);

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/expr/attr-set.hh"
#include "nix/util/configuration.hh"
#include "nix/expr/eval.hh"
#include "nix/store/globals.hh"
#include "nix/store/path.hh"
#include "nix/expr/primops.hh"
#include "nix/expr/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/expr/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)
@ -125,7 +125,7 @@ PrimOp * nix_alloc_primop(
try {
using namespace std::placeholders;
auto p = new
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
(GC)
#endif
nix::PrimOp{
@ -497,7 +497,7 @@ ListBuilder * nix_make_list_builder(nix_c_context * context, EvalState * state,
try {
auto builder = state->state.buildList(capacity);
return new
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
(NoGC)
#endif
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)
{
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
GC_FREE(list_builder);
#else
delete list_builder;
@ -578,7 +578,7 @@ BindingsBuilder * nix_make_bindings_builder(nix_c_context * context, EvalState *
try {
auto bb = state->state.buildBindings(capacity);
return new
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
(NoGC)
#endif
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)
{
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
GC_FREE((nix::BindingsBuilder *) bb);
#else
delete (nix::BindingsBuilder *) bb;

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" {

View file

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

View file

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

View file

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

View file

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

View file

@ -29,28 +29,13 @@ subdir('nix-meson-build-support/subprojects')
rapidcheck = dependency('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')
sources = files(
'tests/value/context.cc',
)
include_dirs = [include_directories('.')]
headers = files(
'tests/libexpr.hh',
'tests/nix_api_expr.hh',
'tests/value/context.hh',
)
subdir('include/nix/expr/tests')
subdir('nix-meson-build-support/export-all-symbols')
subdir('nix-meson-build-support/windows-version')
@ -67,7 +52,7 @@ this_library = library(
install : true,
)
install_headers(headers, subdir : 'nix', preserve_path : true)
install_headers(headers, subdir : 'nix/expr/tests', preserve_path : true)
libraries_private = []

View file

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

View file

@ -1,30 +1,39 @@
#include <rapidcheck.h>
#include "tests/path.hh"
#include "tests/value/context.hh"
#include "nix/store/tests/path.hh"
#include "nix/expr/tests/value/context.hh"
namespace rc {
using namespace nix;
Gen<NixStringContextElem::DrvDeep> Arbitrary<NixStringContextElem::DrvDeep>::arbitrary()
{
return gen::just(NixStringContextElem::DrvDeep {
.drvPath = *gen::arbitrary<StorePath>(),
return gen::map(gen::arbitrary<StorePath>(), [](StorePath drvPath) {
return NixStringContextElem::DrvDeep{
.drvPath = drvPath,
};
});
}
Gen<NixStringContextElem> Arbitrary<NixStringContextElem>::arbitrary()
{
switch (*gen::inRange<uint8_t>(0, std::variant_size_v<NixStringContextElem::Raw>)) {
case 0:
return gen::just<NixStringContextElem>(*gen::arbitrary<NixStringContextElem::Opaque>());
case 1:
return gen::just<NixStringContextElem>(*gen::arbitrary<NixStringContextElem::DrvDeep>());
case 2:
return gen::just<NixStringContextElem>(*gen::arbitrary<NixStringContextElem::Built>());
default:
assert(false);
}
return gen::mapcat(
gen::inRange<uint8_t>(0, std::variant_size_v<NixStringContextElem::Raw>),
[](uint8_t n) -> Gen<NixStringContextElem> {
switch (n) {
case 0:
return gen::map(
gen::arbitrary<NixStringContextElem::Opaque>(), [](NixStringContextElem a) { return a; });
case 1:
return gen::map(
gen::arbitrary<NixStringContextElem::DrvDeep>(), [](NixStringContextElem a) { return a; });
case 2:
return gen::map(
gen::arbitrary<NixStringContextElem::Built>(), [](NixStringContextElem a) { return a; });
default:
assert(false);
}
});
}
}

View file

@ -2,8 +2,8 @@
#include <gtest/gtest.h>
#include <rapidcheck/gtest.h>
#include "tests/derived-path.hh"
#include "tests/libexpr.hh"
#include "nix/store/tests/derived-path.hh"
#include "nix/expr/tests/libexpr.hh"
namespace nix {
@ -44,11 +44,11 @@ RC_GTEST_FIXTURE_PROP(
* to worry about race conditions if the tests run concurrently.
*/
ExperimentalFeatureSettings mockXpSettings;
mockXpSettings.set("experimental-features", "ca-derivations");
mockXpSettings.set("experimental-features", "ca-derivations dynamic-derivations");
auto * v = state.allocValue();
state.mkOutputString(*v, b, std::nullopt, mockXpSettings);
auto [d, _] = state.coerceToSingleDerivedPathUnchecked(noPos, *v, "");
auto [d, _] = state.coerceToSingleDerivedPathUnchecked(noPos, *v, "", mockXpSettings);
RC_ASSERT(SingleDerivedPath { b } == d);
}
@ -57,9 +57,12 @@ RC_GTEST_FIXTURE_PROP(
prop_derived_path_built_out_path_round_trip,
(const SingleDerivedPath::Built & b, const StorePath & outPath))
{
ExperimentalFeatureSettings mockXpSettings;
mockXpSettings.set("experimental-features", "dynamic-derivations");
auto * v = state.allocValue();
state.mkOutputString(*v, b, outPath);
auto [d, _] = state.coerceToSingleDerivedPathUnchecked(noPos, *v, "");
state.mkOutputString(*v, b, outPath, mockXpSettings);
auto [d, _] = state.coerceToSingleDerivedPathUnchecked(noPos, *v, "", mockXpSettings);
RC_ASSERT(SingleDerivedPath { b } == d);
}

View file

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

View file

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

View file

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

View file

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

View file

@ -35,16 +35,12 @@ deps_private += gtest
gtest = dependency('gmock')
deps_private += gtest
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',
'-include', 'config-util.h',
'-include', 'config-store.h',
'-include', 'config-expr.h',
language : 'cpp',
configdata = configuration_data()
configdata.set_quoted('PACKAGE_VERSION', meson.project_version())
config_priv_h = configure_file(
configuration : configdata,
output : 'expr-tests-config.hh',
)
subdir('nix-meson-build-support/common')
@ -72,6 +68,7 @@ include_dirs = [include_directories('.')]
this_exe = executable(
meson.project_name(),
sources,
config_priv_h,
dependencies : deps_private_subproject + deps_private + deps_other,
include_directories : include_dirs,
# TODO: -lrapidcheck, see ../libutil-support/build.meson

View file

@ -5,13 +5,15 @@
#include "nix_api_expr.h"
#include "nix_api_value.h"
#include "tests/nix_api_expr.hh"
#include "tests/string_callback.hh"
#include "file-system.hh"
#include "nix/expr/tests/nix_api_expr.hh"
#include "nix/util/tests/string_callback.hh"
#include "nix/util/file-system.hh"
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "expr-tests-config.hh"
namespace nixC {
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_external.h"
#include "tests/nix_api_expr.hh"
#include "tests/string_callback.hh"
#include "nix/expr/tests/nix_api_expr.hh"
#include "nix/util/tests/string_callback.hh"
#include <gtest/gtest.h>

View file

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

View file

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

View file

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

View file

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

View file

@ -2,9 +2,9 @@
#include <gtest/gtest.h>
#include <rapidcheck/gtest.h>
#include "tests/path.hh"
#include "tests/libexpr.hh"
#include "tests/value/context.hh"
#include "nix/store/tests/path.hh"
#include "nix/expr/tests/libexpr.hh"
#include "nix/expr/tests/value/context.hh"
namespace nix {
@ -124,7 +124,9 @@ RC_GTEST_PROP(
prop_round_rip,
(const NixStringContextElem & o))
{
RC_ASSERT(o == NixStringContextElem::parse(o.to_string()));
ExperimentalFeatureSettings xpSettings;
xpSettings.set("experimental-features", "dynamic-derivations");
RC_ASSERT(o == NixStringContextElem::parse(o.to_string(), xpSettings));
}
#endif

View file

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

View file

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

View file

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

View file

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

View file

@ -1,11 +1,11 @@
#include "users.hh"
#include "eval-cache.hh"
#include "sqlite.hh"
#include "eval.hh"
#include "eval-inline.hh"
#include "store-api.hh"
#include "nix/util/users.hh"
#include "nix/expr/eval-cache.hh"
#include "nix/store/sqlite.hh"
#include "nix/expr/eval.hh"
#include "nix/expr/eval-inline.hh"
#include "nix/store/store-api.hh"
// Need specialization involving `SymbolStr` just in this one module.
#include "strings-inline.hh"
#include "nix/util/strings-inline.hh"
namespace nix::eval_cache {
@ -418,6 +418,14 @@ Value & AttrCursor::getValue()
return **_value;
}
void AttrCursor::fetchCachedValue()
{
if (!cachedValue)
cachedValue = root->db->getAttr(getKey());
if (cachedValue && std::get_if<failed_t>(&cachedValue->second) && parent)
throw CachedEvalError(parent->first, parent->second);
}
std::vector<Symbol> AttrCursor::getAttrPath() const
{
if (parent) {
@ -494,14 +502,13 @@ Suggestions AttrCursor::getSuggestionsForAttr(Symbol name)
std::shared_ptr<AttrCursor> AttrCursor::maybeGetAttr(Symbol name)
{
if (root->db) {
if (!cachedValue)
cachedValue = root->db->getAttr(getKey());
fetchCachedValue();
if (cachedValue) {
if (auto attrs = std::get_if<std::vector<Symbol>>(&cachedValue->second)) {
for (auto & attr : *attrs)
if (attr == name)
return std::make_shared<AttrCursor>(root, std::make_pair(shared_from_this(), attr));
return std::make_shared<AttrCursor>(root, std::make_pair(ref(shared_from_this()), attr));
return nullptr;
} else if (std::get_if<placeholder_t>(&cachedValue->second)) {
auto attr = root->db->getAttr({cachedValue->first, name});
@ -512,7 +519,7 @@ std::shared_ptr<AttrCursor> AttrCursor::maybeGetAttr(Symbol name)
throw CachedEvalError(ref(shared_from_this()), name);
else
return std::make_shared<AttrCursor>(root,
std::make_pair(shared_from_this(), name), nullptr, std::move(attr));
std::make_pair(ref(shared_from_this()), name), nullptr, std::move(attr));
}
// Incomplete attrset, so need to fall thru and
// evaluate to see whether 'name' exists
@ -547,7 +554,7 @@ std::shared_ptr<AttrCursor> AttrCursor::maybeGetAttr(Symbol name)
}
return make_ref<AttrCursor>(
root, std::make_pair(shared_from_this(), name), attr->value, std::move(cachedValue2));
root, std::make_pair(ref(shared_from_this()), name), attr->value, std::move(cachedValue2));
}
std::shared_ptr<AttrCursor> AttrCursor::maybeGetAttr(std::string_view name)
@ -585,8 +592,7 @@ OrSuggestions<ref<AttrCursor>> AttrCursor::findAlongAttrPath(const std::vector<S
std::string AttrCursor::getString()
{
if (root->db) {
if (!cachedValue)
cachedValue = root->db->getAttr(getKey());
fetchCachedValue();
if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) {
if (auto s = std::get_if<string_t>(&cachedValue->second)) {
debug("using cached string attribute '%s'", getAttrPathStr());
@ -607,8 +613,7 @@ std::string AttrCursor::getString()
string_t AttrCursor::getStringWithContext()
{
if (root->db) {
if (!cachedValue)
cachedValue = root->db->getAttr(getKey());
fetchCachedValue();
if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) {
if (auto s = std::get_if<string_t>(&cachedValue->second)) {
bool valid = true;
@ -654,8 +659,7 @@ string_t AttrCursor::getStringWithContext()
bool AttrCursor::getBool()
{
if (root->db) {
if (!cachedValue)
cachedValue = root->db->getAttr(getKey());
fetchCachedValue();
if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) {
if (auto b = std::get_if<bool>(&cachedValue->second)) {
debug("using cached Boolean attribute '%s'", getAttrPathStr());
@ -676,8 +680,7 @@ bool AttrCursor::getBool()
NixInt AttrCursor::getInt()
{
if (root->db) {
if (!cachedValue)
cachedValue = root->db->getAttr(getKey());
fetchCachedValue();
if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) {
if (auto i = std::get_if<int_t>(&cachedValue->second)) {
debug("using cached integer attribute '%s'", getAttrPathStr());
@ -698,8 +701,7 @@ NixInt AttrCursor::getInt()
std::vector<std::string> AttrCursor::getListOfStrings()
{
if (root->db) {
if (!cachedValue)
cachedValue = root->db->getAttr(getKey());
fetchCachedValue();
if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) {
if (auto l = std::get_if<std::vector<std::string>>(&cachedValue->second)) {
debug("using cached list of strings attribute '%s'", getAttrPathStr());
@ -731,8 +733,7 @@ std::vector<std::string> AttrCursor::getListOfStrings()
std::vector<Symbol> AttrCursor::getAttrs()
{
if (root->db) {
if (!cachedValue)
cachedValue = root->db->getAttr(getKey());
fetchCachedValue();
if (cachedValue && !std::get_if<placeholder_t>(&cachedValue->second)) {
if (auto attrs = std::get_if<std::vector<Symbol>>(&cachedValue->second)) {
debug("using cached attrset attribute '%s'", getAttrPathStr());

View file

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

View file

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

View file

@ -1,8 +1,8 @@
#include "users.hh"
#include "globals.hh"
#include "profiles.hh"
#include "eval.hh"
#include "eval-settings.hh"
#include "nix/util/users.hh"
#include "nix/store/globals.hh"
#include "nix/store/profiles.hh"
#include "nix/expr/eval.hh"
#include "nix/expr/eval-settings.hh"
namespace nix {
@ -103,4 +103,4 @@ Path getNixDefExpr()
: getHome() + "/.nix-defexpr";
}
}
} // namespace nix

View file

@ -1,25 +1,26 @@
#include "eval.hh"
#include "eval-settings.hh"
#include "primops.hh"
#include "print-options.hh"
#include "exit.hh"
#include "types.hh"
#include "util.hh"
#include "store-api.hh"
#include "derivations.hh"
#include "downstream-placeholder.hh"
#include "eval-inline.hh"
#include "filetransfer.hh"
#include "function-trace.hh"
#include "profiles.hh"
#include "print.hh"
#include "filtering-source-accessor.hh"
#include "memory-source-accessor.hh"
#include "mounted-source-accessor.hh"
#include "gc-small-vector.hh"
#include "url.hh"
#include "fetch-to-store.hh"
#include "tarball.hh"
#include "nix/expr/eval.hh"
#include "nix/expr/eval-settings.hh"
#include "nix/expr/primops.hh"
#include "nix/expr/print-options.hh"
#include "nix/util/exit.hh"
#include "nix/util/types.hh"
#include "nix/util/util.hh"
#include "nix/store/store-api.hh"
#include "nix/store/derivations.hh"
#include "nix/store/downstream-placeholder.hh"
#include "nix/expr/eval-inline.hh"
#include "nix/store/filetransfer.hh"
#include "nix/expr/function-trace.hh"
#include "nix/store/profiles.hh"
#include "nix/expr/print.hh"
#include "nix/fetchers/filtering-source-accessor.hh"
#include "nix/util/memory-source-accessor.hh"
#include "nix/util/mounted-source-accessor.hh"
#include "nix/expr/gc-small-vector.hh"
#include "nix/util/url.hh"
#include "nix/fetchers/fetch-to-store.hh"
#include "nix/fetchers/tarball.hh"
#include "parser-tab.hh"
#include <algorithm>
@ -39,7 +40,7 @@
# include <sys/resource.h>
#endif
#include "strings-inline.hh"
#include "nix/util/strings-inline.hh"
using json = nlohmann::json;
@ -290,17 +291,13 @@ EvalState::EvalState(
CanonPath("derivation-internal.nix"),
#include "primops/derivation.nix.gen.hh"
)}
, callFlakeInternal{internalFS->addFile(
CanonPath("call-flake.nix"),
#include "call-flake.nix.gen.hh"
)}
, store(store)
, buildStore(buildStore ? buildStore : store)
, debugRepl(nullptr)
, debugStop(false)
, trylevel(0)
, regexCache(makeRegexCache())
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
, valueAllocCache(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)))
@ -355,7 +352,7 @@ EvalState::EvalState(
#include "fetchurl.nix.gen.hh"
);
createBaseEnv();
createBaseEnv(settings);
}
@ -2251,18 +2248,18 @@ std::string_view EvalState::forceString(Value & v, const PosIdx pos, std::string
}
void copyContext(const Value & v, NixStringContext & context)
void copyContext(const Value & v, NixStringContext & context, const ExperimentalFeatureSettings & xpSettings)
{
if (v.payload.string.context)
for (const char * * p = v.payload.string.context; *p; ++p)
context.insert(NixStringContextElem::parse(*p));
context.insert(NixStringContextElem::parse(*p, xpSettings));
}
std::string_view EvalState::forceString(Value & v, NixStringContext & context, const PosIdx pos, std::string_view errorCtx)
std::string_view EvalState::forceString(Value & v, NixStringContext & context, const PosIdx pos, std::string_view errorCtx, const ExperimentalFeatureSettings & xpSettings)
{
auto s = forceString(v, pos, errorCtx);
copyContext(v, context);
copyContext(v, context, xpSettings);
return s;
}
@ -2468,10 +2465,10 @@ StorePath EvalState::coerceToStorePath(const PosIdx pos, Value & v, NixStringCon
}
std::pair<SingleDerivedPath, std::string_view> EvalState::coerceToSingleDerivedPathUnchecked(const PosIdx pos, Value & v, std::string_view errorCtx)
std::pair<SingleDerivedPath, std::string_view> EvalState::coerceToSingleDerivedPathUnchecked(const PosIdx pos, Value & v, std::string_view errorCtx, const ExperimentalFeatureSettings & xpSettings)
{
NixStringContext context;
auto s = forceString(v, context, pos, errorCtx);
auto s = forceString(v, context, pos, errorCtx, xpSettings);
auto csize = context.size();
if (csize != 1)
error<EvalError>(
@ -2817,7 +2814,7 @@ bool EvalState::eqValues(Value & v1, Value & v2, const PosIdx pos, std::string_v
}
bool EvalState::fullGC() {
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
GC_gcollect();
// 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.
@ -2836,7 +2833,7 @@ void EvalState::maybePrintStats()
if (showStats) {
// Make the final heap size more deterministic.
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
if (!fullGC()) {
warn("failed to perform a full GC before reporting stats");
}
@ -2858,7 +2855,7 @@ void EvalState::printStatistics()
uint64_t bValues = nrValues * sizeof(Value);
uint64_t bAttrsets = nrAttrsets * sizeof(Bindings) + nrAttrsInAttrsets * sizeof(Attr);
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
GC_word heapSize, totalBytes;
GC_get_heap_usage_safe(&heapSize, 0, 0, 0, &totalBytes);
double gcFullOnlyTime = ({
@ -2880,7 +2877,7 @@ void EvalState::printStatistics()
#ifndef _WIN32 // TODO implement
{"cpu", cpuTime},
#endif
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
{GC_is_incremental_mode() ? "gcNonIncremental" : "gc", gcFullOnlyTime},
#ifndef _WIN32 // TODO implement
{GC_is_incremental_mode() ? "gcNonIncrementalFraction" : "gcFraction", gcFullOnlyTime / cpuTime},
@ -2924,7 +2921,7 @@ void EvalState::printStatistics()
topObj["nrLookups"] = nrLookups;
topObj["nrPrimOpCalls"] = nrPrimOpCalls;
topObj["nrFunctionCalls"] = nrFunctionCalls;
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
topObj["gc"] = {
{"heapSize", heapSize},
{"totalBytes", totalBytes},

View file

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

View file

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

View file

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

View file

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

View file

@ -1,9 +1,9 @@
#pragma once
///@file
#include "sync.hh"
#include "hash.hh"
#include "eval.hh"
#include "nix/util/sync.hh"
#include "nix/util/hash.hh"
#include "nix/expr/eval.hh"
#include <functional>
#include <variant>
@ -90,7 +90,7 @@ class AttrCursor : public std::enable_shared_from_this<AttrCursor>
friend struct CachedEvalError;
ref<EvalCache> root;
typedef std::optional<std::pair<std::shared_ptr<AttrCursor>, Symbol>> Parent;
using Parent = std::optional<std::pair<ref<AttrCursor>, Symbol>>;
Parent parent;
RootValue _value;
std::optional<std::pair<AttrId, AttrValue>> cachedValue;
@ -99,6 +99,14 @@ class AttrCursor : public std::enable_shared_from_this<AttrCursor>
Value & getValue();
/**
* If `cachedValue` is unset, try to initialize it from the
* database. It is not an error if it does not exist. Throw a
* `CachedEvalError` exception if it does exist but has type
* `AttrType::Failed`.
*/
void fetchCachedValue();
public:
AttrCursor(

View file

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

View file

@ -3,7 +3,10 @@
#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
@ -43,7 +46,7 @@ void initGC();
*/
void assertGCInitialized();
#ifdef HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
/**
* The number of GC cycles since initGC().
*/

View file

@ -1,10 +1,13 @@
#pragma once
///@file
#include "print.hh"
#include "eval.hh"
#include "eval-error.hh"
#include "eval-settings.hh"
#include "nix/expr/print.hh"
#include "nix/expr/eval.hh"
#include "nix/expr/eval-error.hh"
#include "nix/expr/eval-settings.hh"
// For `NIX_USE_BOEHMGC`, and if that's set, `GC_THREADS`
#include "nix/expr/config.hh"
namespace nix {
@ -15,7 +18,7 @@ namespace nix {
inline void * allocBytes(size_t n)
{
void * p;
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
p = GC_MALLOC(n);
#else
p = calloc(n, 1);
@ -28,7 +31,7 @@ inline void * allocBytes(size_t n)
[[gnu::always_inline]]
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).
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
@ -60,7 +63,7 @@ Env & EvalState::allocEnv(size_t size)
Env * env;
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
if (size == 1) {
/* see allocValue for explanations. */
if (!*env1AllocCache) {

View file

@ -1,12 +1,13 @@
#pragma once
///@file
#include "config.hh"
#include "source-path.hh"
#include "nix/util/configuration.hh"
#include "nix/util/source-path.hh"
namespace nix {
class EvalState;
struct PrimOp;
struct EvalSettings : Config
{
@ -50,6 +51,8 @@ struct EvalSettings : Config
LookupPathHooks lookupPathHooks;
std::vector<PrimOp> extraPrimOps;
Setting<bool> enableNativeCode{this, false, "allow-unsafe-native-code-during-evaluation", R"(
Enable built-in functions that allow executing native code.

View file

@ -1,20 +1,23 @@
#pragma once
///@file
#include "attr-set.hh"
#include "eval-error.hh"
#include "types.hh"
#include "value.hh"
#include "nixexpr.hh"
#include "symbol-table.hh"
#include "config.hh"
#include "experimental-features.hh"
#include "position.hh"
#include "pos-table.hh"
#include "source-accessor.hh"
#include "search-path.hh"
#include "repl-exit-status.hh"
#include "ref.hh"
#include "nix/expr/attr-set.hh"
#include "nix/expr/eval-error.hh"
#include "nix/util/types.hh"
#include "nix/expr/value.hh"
#include "nix/expr/nixexpr.hh"
#include "nix/expr/symbol-table.hh"
#include "nix/util/configuration.hh"
#include "nix/util/experimental-features.hh"
#include "nix/util/position.hh"
#include "nix/util/pos-table.hh"
#include "nix/util/source-accessor.hh"
#include "nix/expr/search-path.hh"
#include "nix/expr/repl-exit-status.hh"
#include "nix/util/ref.hh"
// For `NIX_USE_BOEHMGC`, and if that's set, `GC_THREADS`
#include "nix/expr/config.hh"
#include <map>
#include <optional>
@ -160,7 +163,7 @@ void printEnvBindings(const SymbolTable & st, const StaticEnv & se, const Env &
std::unique_ptr<ValMap> mapStaticEnvBindings(const SymbolTable & st, const StaticEnv & se, const Env & env);
void copyContext(const Value & v, NixStringContext & context);
void copyContext(const Value & v, NixStringContext & context, const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
std::string printValue(EvalState & state, Value & v);
@ -280,14 +283,12 @@ public:
/**
* In-memory filesystem for internal, non-user-callable Nix
* expressions like call-flake.nix.
* expressions like `derivation.nix`.
*/
const ref<MemorySourceAccessor> internalFS;
const SourcePath derivationInternal;
const SourcePath callFlakeInternal;
/**
* Store used to materialise .drv files.
*/
@ -377,7 +378,7 @@ private:
*/
std::shared_ptr<RegexCache> regexCache;
#if HAVE_BOEHMGC
#if NIX_USE_BOEHMGC
/**
* Allocation cache for GC'd Value objects.
*/
@ -533,7 +534,7 @@ public:
*/
void forceFunction(Value & v, const PosIdx pos, std::string_view errorCtx);
std::string_view forceString(Value & v, const PosIdx pos, std::string_view errorCtx);
std::string_view forceString(Value & v, NixStringContext & context, const PosIdx pos, std::string_view errorCtx);
std::string_view forceString(Value & v, NixStringContext & context, const PosIdx pos, std::string_view errorCtx, const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
std::string_view forceStringNoCtx(Value & v, const PosIdx pos, std::string_view errorCtx);
template<typename... Args>
@ -585,7 +586,7 @@ public:
/**
* Part of `coerceToSingleDerivedPath()` without any store IO which is exposed for unit testing only.
*/
std::pair<SingleDerivedPath, std::string_view> coerceToSingleDerivedPathUnchecked(const PosIdx pos, Value & v, std::string_view errorCtx);
std::pair<SingleDerivedPath, std::string_view> coerceToSingleDerivedPathUnchecked(const PosIdx pos, Value & v, std::string_view errorCtx, const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
/**
* Coerce to `SingleDerivedPath`.
@ -604,7 +605,7 @@ public:
*/
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. */
std::shared_ptr<Env *> baseEnvP;
#endif
@ -639,7 +640,7 @@ private:
unsigned int baseEnvDispl = 0;
void createBaseEnv();
void createBaseEnv(const EvalSettings & settings);
Value * addConstant(const std::string & name, Value & v, Constant info);
@ -952,4 +953,4 @@ bool isAllowedURI(std::string_view uri, const Strings & allowedPaths);
}
#include "eval-inline.hh"
#include "nix/expr/eval-inline.hh"

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,37 @@
# Public headers directory
include_dirs = [include_directories('../..')]
config_pub_h = configure_file(
configuration : configdata_pub,
output : '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 <vector>
#include "value.hh"
#include "symbol-table.hh"
#include "eval-error.hh"
#include "pos-idx.hh"
#include "nix/expr/value.hh"
#include "nix/expr/symbol-table.hh"
#include "nix/expr/eval-error.hh"
#include "nix/util/pos-idx.hh"
namespace nix {

View file

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

View file

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

View file

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

View file

@ -9,8 +9,8 @@
#include <iostream>
#include "fmt.hh"
#include "print-options.hh"
#include "nix/util/fmt.hh"
#include "nix/expr/print-options.hh"
namespace nix {

View file

@ -3,8 +3,8 @@
#include <optional>
#include "types.hh"
#include "comparator.hh"
#include "nix/util/types.hh"
#include "nix/util/comparator.hh"
namespace nix {

View file

@ -5,9 +5,9 @@
#include <map>
#include <unordered_map>
#include "types.hh"
#include "chunked-vector.hh"
#include "error.hh"
#include "nix/util/types.hh"
#include "nix/util/chunked-vector.hh"
#include "nix/util/error.hh"
namespace nix {

View file

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

View file

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

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