update lix and nixpkgs

This commit is contained in:
xenia 2025-04-18 21:51:47 -04:00
parent d2b8ffb94e
commit c2fc8fbb93
3 changed files with 81 additions and 39 deletions

View File

@ -3,38 +3,38 @@
"lix": { "lix": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1729298361, "lastModified": 1737234286,
"narHash": "sha256-hiGtfzxFkDc9TSYsb96Whg0vnqBVV7CUxyscZNhed0U=", "narHash": "sha256-CCKIAE84dzkrnlxJCKFyffAxP3yfsOAbdvydUGqq24g=",
"rev": "ad9d06f7838a25beec425ff406fe68721fef73be", "rev": "2837da71ec1588c1187d2e554719b15904a46c8b",
"type": "tarball", "type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/ad9d06f7838a25beec425ff406fe68721fef73be.tar.gz?rev=ad9d06f7838a25beec425ff406fe68721fef73be" "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/2837da71ec1588c1187d2e554719b15904a46c8b.tar.gz?rev=2837da71ec1588c1187d2e554719b15904a46c8b"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
"url": "https://git.lix.systems/lix-project/lix/archive/2.91.1.tar.gz" "url": "https://git.lix.systems/lix-project/lix/archive/2.92.0.tar.gz"
} }
}, },
"lix-module": { "lix-module": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1732605668, "lastModified": 1742943028,
"narHash": "sha256-DN5/166jhiiAW0Uw6nueXaGTueVxhfZISAkoxasmz/g=", "narHash": "sha256-fprwZKE1uMzO9tiWWOrmLWBW3GPkMayQfb0xOvVFIno=",
"rev": "f19bd752910bbe3a861c9cad269bd078689d50fe", "rev": "868d97695bab9d21f6070b03957bcace249fbe3c",
"type": "tarball", "type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/f19bd752910bbe3a861c9cad269bd078689d50fe.tar.gz?rev=f19bd752910bbe3a861c9cad269bd078689d50fe" "url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/868d97695bab9d21f6070b03957bcace249fbe3c.tar.gz?rev=868d97695bab9d21f6070b03957bcace249fbe3c"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
"url": "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-2.tar.gz" "url": "https://git.lix.systems/lix-project/nixos-module/archive/2.92.0-3.tar.gz"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1742669843, "lastModified": 1744932701,
"narHash": "sha256-G5n+FOXLXcRx+3hCJ6Rt6ZQyF1zqQ0DL0sWAMn2Nk0w=", "narHash": "sha256-fusHbZCyv126cyArUwwKrLdCkgVAIaa/fQJYFlCEqiU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1e5b653dff12029333a6546c11e108ede13052eb", "rev": "b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -5,12 +5,12 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
lix-module = { lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-2.tar.gz"; url = "https://git.lix.systems/lix-project/nixos-module/archive/2.92.0-3.tar.gz";
flake = false; flake = false;
}; };
lix = { lix = {
url = "https://git.lix.systems/lix-project/lix/archive/2.91.1.tar.gz"; url = "https://git.lix.systems/lix-project/lix/archive/2.92.0.tar.gz";
flake = false; flake = false;
}; };
}; };

View File

@ -1,14 +1,14 @@
From 5e42fc10f1e0b276fc32600dcab7cd560cc3e00f Mon Sep 17 00:00:00 2001 From 10a24d7831f51549d8c05193a0fbc329cc327fbe 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 | 34 +++++++++------------------------- extra-builtins.cc | 87 ++++++++++++++++-------------------------
meson.build | 18 ++++++++++++++++++ meson.build | 18 +++++++++
nix-plugins-config.h.in | 3 --- nix-plugins-config.h.in | 3 --
4 files changed, 27 insertions(+), 55 deletions(-) 4 files changed, 51 insertions(+), 84 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,46 +47,88 @@ 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..03947ef 100644 index 3a0f90e..f2978f8 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 @@
#include <config.h> -#include <config.h>
#include <primops.hh> -#include <primops.hh>
#include <globals.hh> -#include <globals.hh>
-#include <config-global.hh> -#include <config-global.hh>
#include <eval-settings.hh> -#include <eval-settings.hh>
#include <common-eval-args.hh> -#include <common-eval-args.hh>
-#include <filtering-source-accessor.hh> -#include <filtering-source-accessor.hh>
- -
-#include "nix-plugins-config.h" -#include "nix-plugins-config.h"
+#include <lix/config.h>
+#include <lix/libexpr/primops.hh>
+#include <lix/libstore/globals.hh>
+#include <lix/libexpr/eval-settings.hh>
+#include <lix/libcmd/common-eval-args.hh>
using namespace nix; using namespace nix;
@@ -24,13 +20,17 @@ static GlobalConfig::Register rp(&extraBuiltinsSettings); @@ -24,39 +20,38 @@ 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)
{ {
- static auto extraBuiltinsFile = state.rootPath(CanonPath(extraBuiltinsSettings.extraBuiltinsFile.to_string())); - static auto extraBuiltinsFile = state.rootPath(CanonPath(extraBuiltinsSettings.extraBuiltinsFile.to_string()));
- if (auto rootFS2 = state.rootFS.dynamic_pointer_cast<AllowListSourceAccessor>()) - if (auto rootFS2 = state.rootFS.dynamic_pointer_cast<AllowListSourceAccessor>())
- rootFS2->allowPrefix(CanonPath(extraBuiltinsFile.path.abs())); - rootFS2->allowPrefix(CanonPath(extraBuiltinsFile.path.abs()));
+ static auto extraBuiltinsFile = state.rootPath( + static auto extraBuiltinsFile =
+ CanonPath(extraBuiltinsSettings.extraBuiltinsFile.to_string())); + SourcePath(CanonPath(extraBuiltinsSettings.extraBuiltinsFile.to_string()));
try { try {
auto fun = state.allocValue(); - auto fun = state.allocValue();
- state.evalFile(extraBuiltinsFile, *fun); - state.evalFile(extraBuiltinsFile, *fun);
- Value * arg;
- if (evalSettings.enableNativeCode) {
- arg = state.baseEnv.values[0];
- } else {
- auto attrs = state.buildBindings(2);
-
- auto sExec = state.symbols.create("exec");
- attrs.alloc(sExec).mkPrimOp(new PrimOp {
- .name = "exec",
- .arity = 1,
- .fun = prim_exec,
- });
-
- auto sImportNative = state.symbols.create("importNative");
- attrs.alloc(sImportNative).mkPrimOp(new PrimOp {
- .name = "importNative",
- .arity = 2,
- .fun = prim_importNative,
- });
-
- arg = state.allocValue();
- arg->mkAttrs(attrs);
- }
+ auto fun = state.ctx.mem.allocValue();
+ +
+ // bypass the source path checking by directly reading and evaluating the file + // bypass the source path checking by directly reading and evaluating the file
+ // this also bypasses the eval cache but oh well + // this also bypasses the eval cache but oh well
+ Expr& e = state.parseExprFromFile(extraBuiltinsFile); + Expr& e = state.ctx.parseExprFromFile(extraBuiltinsFile.unsafeIntoChecked());
+ state.eval(e, *fun); + state.eval(e, *fun);
+ +
Value * arg; + auto attrs = state.ctx.buildBindings(2);
if (evalSettings.enableNativeCode) { +
arg = state.baseEnv.values[0]; + auto sExec = state.ctx.symbols.create("exec");
@@ -56,7 +56,7 @@ static void extraBuiltins(EvalState & state, const PosIdx pos, + attrs.alloc(sExec).mkPrimOp(new PrimOp {
} + .name = "exec",
+ .arity = 1,
+ .fun = prim_exec,
+ });
+
+ auto sImportNative = state.ctx.symbols.create("importNative");
+ attrs.alloc(sImportNative).mkPrimOp(new PrimOp {
+ .name = "importNative",
+ .arity = 2,
+ .fun = prim_importNative,
+ });
+
+ Value* arg = state.ctx.mem.allocValue();
+ arg->mkAttrs(attrs);
v.mkApp(fun, arg); v.mkApp(fun, arg);
state.forceValue(v, pos); state.forceValue(v, pos);
- } catch (FileNotFound &) { - } catch (FileNotFound &) {
@ -94,7 +136,7 @@ index 3a0f90e..03947ef 100644
v.mkNull(); v.mkNull();
} }
} }
@@ -66,19 +66,3 @@ static RegisterPrimOp rp1({ @@ -66,19 +61,3 @@ static RegisterPrimOp rp1({
.arity = 0, .arity = 0,
.fun = extraBuiltins, .fun = extraBuiltins,
}); });
@ -148,5 +190,5 @@ index 459fea8..0000000
-#define NIX_CFLAGS_OTHER "@NIX_CFLAGS_OTHER@" -#define NIX_CFLAGS_OTHER "@NIX_CFLAGS_OTHER@"
-#define BOOST_INCLUDE_DIR "@BOOST_INCLUDE_DIR@" -#define BOOST_INCLUDE_DIR "@BOOST_INCLUDE_DIR@"
-- --
2.47.0 2.47.2