oops 42071

This commit is contained in:
xenia 2024-12-21 16:35:03 -05:00
parent 5e2bfd4065
commit 6978c9e38d
1 changed files with 15 additions and 10 deletions

View File

@ -1,14 +1,14 @@
From db0c0622ec4bfdc18e1ff53f47f0b922dacb111f Mon Sep 17 00:00:00 2001 From 5e42fc10f1e0b276fc32600dcab7cd560cc3e00f Mon Sep 17 00:00:00 2001
From: xenia <xenia@awoo.systems> From: xenia <xenia@awoo.systems>
Date: Sat, 21 Dec 2024 15:33:10 -0500 Date: Sat, 21 Dec 2024 15:33:10 -0500
Subject: [PATCH] implement lix support Subject: [PATCH] implement lix support
--- ---
CMakeLists.txt | 27 --------------------------- CMakeLists.txt | 27 ---------------------------
extra-builtins.cc | 29 +++++------------------------ extra-builtins.cc | 34 +++++++++-------------------------
meson.build | 18 ++++++++++++++++++ meson.build | 18 ++++++++++++++++++
nix-plugins-config.h.in | 3 --- nix-plugins-config.h.in | 3 ---
4 files changed, 23 insertions(+), 54 deletions(-) 4 files changed, 27 insertions(+), 55 deletions(-)
delete mode 100644 CMakeLists.txt delete mode 100644 CMakeLists.txt
create mode 100644 meson.build create mode 100644 meson.build
delete mode 100644 nix-plugins-config.h.in delete mode 100644 nix-plugins-config.h.in
@ -47,7 +47,7 @@ index 9674fe8..0000000
- -
-install(TARGETS nix-extra-builtins DESTINATION lib/nix/plugins) -install(TARGETS nix-extra-builtins DESTINATION lib/nix/plugins)
diff --git a/extra-builtins.cc b/extra-builtins.cc diff --git a/extra-builtins.cc b/extra-builtins.cc
index 3a0f90e..7262d2f 100644 index 3a0f90e..03947ef 100644
--- a/extra-builtins.cc --- a/extra-builtins.cc
+++ b/extra-builtins.cc +++ b/extra-builtins.cc
@@ -1,12 +1,8 @@ @@ -1,12 +1,8 @@
@ -63,7 +63,7 @@ index 3a0f90e..7262d2f 100644
using namespace nix; using namespace nix;
@@ -24,12 +20,13 @@ static GlobalConfig::Register rp(&extraBuiltinsSettings); @@ -24,13 +20,17 @@ static GlobalConfig::Register rp(&extraBuiltinsSettings);
static void extraBuiltins(EvalState & state, const PosIdx pos, static void extraBuiltins(EvalState & state, const PosIdx pos,
Value ** _args, Value & v) Value ** _args, Value & v)
{ {
@ -75,12 +75,17 @@ index 3a0f90e..7262d2f 100644
try { try {
auto fun = state.allocValue(); auto fun = state.allocValue();
+ state.allowPath(extraBuiltinsFile.path.abs()); - state.evalFile(extraBuiltinsFile, *fun);
+ state.allowPath(state.checkSourcePath(extraBuiltinsFile).path.abs()); +
state.evalFile(extraBuiltinsFile, *fun); + // bypass the source path checking by directly reading and evaluating the file
+ // this also bypasses the eval cache but oh well
+ Expr& e = state.parseExprFromFile(extraBuiltinsFile);
+ state.eval(e, *fun);
+
Value * arg; Value * arg;
if (evalSettings.enableNativeCode) { if (evalSettings.enableNativeCode) {
@@ -56,7 +53,7 @@ static void extraBuiltins(EvalState & state, const PosIdx pos, arg = state.baseEnv.values[0];
@@ -56,7 +56,7 @@ static void extraBuiltins(EvalState & state, const PosIdx pos,
} }
v.mkApp(fun, arg); v.mkApp(fun, arg);
state.forceValue(v, pos); state.forceValue(v, pos);
@ -89,7 +94,7 @@ index 3a0f90e..7262d2f 100644
v.mkNull(); v.mkNull();
} }
} }
@@ -66,19 +63,3 @@ static RegisterPrimOp rp1({ @@ -66,19 +66,3 @@ static RegisterPrimOp rp1({
.arity = 0, .arity = 0,
.fun = extraBuiltins, .fun = extraBuiltins,
}); });