Conversation
In NixOS/nix#14584 mkString was changed to require an `EvalMemory`, part of a larger effort to centralize memory allocation.
|
Thanks @avidal. Here is a sample flake.nix like #25 did. {
inputs.nixpkgs.url = "github:NixOS/nixpkgs/c5c4a43b"; # nixos-26.05 20260901
outputs = { nixpkgs, ... }:
let
forAllSystems = f: nixpkgs.lib.genAttrs
[ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]
(system: f nixpkgs.legacyPackages.${system});
in
{
devShells = forAllSystems (pkgs:
let
nix = pkgs.nixVersions.nix_2_34;
nixComponents = pkgs.nixVersions.nixComponents_2_34;
nix-plugins-broken = pkgs.nix-plugins.override { inherit nixComponents; };
nix-plugins-fixed = nix-plugins-broken.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [
(pkgs.writeText "nix-2.33.patch" ''
--- a/extra-builtins.cc
+++ b/extra-builtins.cc
@@ -72,9 +72,9 @@ static void cflags(EvalState & state, const PosIdx _pos,
Value ** _args, Value & v)
{
auto attrs = state.buildBindings(3);
- attrs.alloc("NIX_INCLUDE_DIRS").mkString(NIX_INCLUDE_DIRS);
- attrs.alloc("NIX_CFLAGS_OTHER").mkString(NIX_CFLAGS_OTHER);
- attrs.alloc("BOOST_INCLUDE_DIR").mkString(BOOST_INCLUDE_DIR);
+ attrs.alloc("NIX_INCLUDE_DIRS").mkString(NIX_INCLUDE_DIRS, state.mem);
+ attrs.alloc("NIX_CFLAGS_OTHER").mkString(NIX_CFLAGS_OTHER, state.mem);
+ attrs.alloc("BOOST_INCLUDE_DIR").mkString(BOOST_INCLUDE_DIR, state.mem);
v.mkAttrs(attrs);
}
'')
(pkgs.writeText "nix-2.34.patch" ''
--- a/extra-builtins.cc
+++ b/extra-builtins.cc
@@ -12,8 +12,8 @@
using namespace nix;
struct ExtraBuiltinsSettings : Config {
- Setting<Path> extraBuiltinsFile{this,
- settings.nixConfDir + "/extra-builtins.nix",
+ Setting<std::filesystem::path> extraBuiltinsFile{this,
+ nixConfDir() + "/extra-builtins.nix",
"extra-builtins-file",
"The path to a nix expression defining extra expression-language level builtins."};
};
@@ -42,14 +42,14 @@ static void extraBuiltins(EvalState & state, const PosIdx pos,
attrs.alloc(sExec).mkPrimOp(new PrimOp {
.name = "exec",
.arity = 1,
- .fun = prim_exec,
+ .impl = prim_exec,
});
auto sImportNative = state.symbols.create("importNative");
attrs.alloc(sImportNative).mkPrimOp(new PrimOp {
.name = "importNative",
.arity = 2,
- .fun = prim_importNative,
+ .impl = prim_importNative,
});
arg = state.allocValue();
@@ -65,7 +65,7 @@ static void extraBuiltins(EvalState & state, const PosIdx pos,
static RegisterPrimOp rp1({
.name = "__extraBuiltins",
.arity = 0,
- .fun = extraBuiltins,
+ .impl = extraBuiltins,
});
static void cflags(EvalState & state, const PosIdx _pos,
@@ -81,5 +81,5 @@ static void cflags(EvalState & state, const PosIdx _pos,
static RegisterPrimOp rp2({
.name = "__nix-cflags",
.arity = 0,
- .fun = cflags,
+ .impl = cflags,
});
'')
];
});
extra-builtins = pkgs.writeText "extra-builtins.nix" ''
{ ... }: { hello = "nix-plugins works!"; }
'';
mkShell = nix-plugins: pkgs.mkShell {
packages = [ nix ];
NIX_CONFIG = ''
plugin-files = ${nix-plugins}/lib/nix/plugins
extra-builtins-file = ${extra-builtins}
'';
};
in
{
broken = mkShell nix-plugins-broken;
fixed = mkShell nix-plugins-fixed;
default = mkShell nix-plugins-fixed;
}
);
};
}Test commands: NOTE: If the host enabled nix-plugins, the test commands will print the |
|
Consider NixOS/Nix always broken nix-plugins, here is my Tips:
|
As usual, NixOS 26.05 brings Nix 2.34, and Nix 2.34 brings broken changes. This patch will fix compile errors for Nix 2.34. BTW: This PR include shlevy#25 for it is required and still not be merged..
7962ab3 to
51ab783
Compare
|
Will review this week, thanks |
As usual, NixOS 26.05 brings Nix 2.34, and Nix 2.34 brings broken changes. This patch will fix compile errors for Nix 2.34.
BTW: This PR include #25 for it is required and still not be merged..