19 Mar 2025 |
Leonardo Santiago | should I be able to copy derivation closures between remote stores without passing through my own local machine? | 12:08:35 |
Leonardo Santiago | I tried doing it through the FFI but it grinds to a halt and never returns | 12:08:52 |
| xokdvium changed their display name from xokdvium to Sergei Zimmerman (xokdvium). | 21:12:16 |
22 Mar 2025 |
| yorickvp joined the room. | 14:18:57 |
yorickvp | in theory yes, in practice I think the copying code does some calls that aren't efficient if both stores are remote | 14:20:54 |
28 Mar 2025 |
Robert Hensing (roberth) | Heads-up regarding libflake initialization breaking in 2.28 https://github.com/roberth/nix/blob/0c75581d8b7cfbfa7a8db9b5dcbf0cbf0709009f/doc/manual/rl-next/c-api-flake-init.md | 18:06:59 |
Robert Hensing (roberth) | I've decided to keep it simple and break this, since the changed solution is a recent addition, and C API progress is slow enough as is. Contributions welcome :) | 18:09:40 |
2 Apr 2025 |
Robert Hensing (roberth) | PR adding exposing flake locking functionality in the C API | 16:17:09 |
4 Apr 2025 |
Robert Hensing (roberth) | rfr ^ | 14:46:50 |
Robert Hensing (roberth) | we don't have a solution for actually loading settings yet | 14:47:30 |
Leonardo Santiago | I'm getting SIGSEGV when calling nix_get_attr_byname with (what it seems to me are) completely valid arguments, that shouldn't even throw an error. | 16:15:40 |
Leonardo Santiago | This is as much information as I can gather from gdb, as I don't know how to enable debug information on the nix C API, for some reason setting dontStrip = true doesn't work for the nix-{x}-c packages.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6aaee5a in nix::ExprVar::eval(nix::EvalState&, nix::Env&, nix::Value&) ()
from /nix/store/8dlfn55w3b3szqsph1dp2i2jqg0di1gr-nix-expr-2.27.0/lib/libnixexpr.so
| 16:17:55 |
Leonardo Santiago | Not sure how to improve this report, the nix expression is fairly complex and I can't include it, but the program itself should just call eval on an expression from file then access its attributes one by one in a list. I'd like to get some line number information going on but I don't seem to be able to. | 16:20:23 |
Leonardo Santiago | * This is as much information as I can gather from gdb, as I don't know how to enable debug information on the nix C API .so libraries, for some reason setting dontStrip = true doesn't work for the nix-{x}-c packages.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6aaee5a in nix::ExprVar::eval(nix::EvalState&, nix::Env&, nix::Value&) ()
from /nix/store/8dlfn55w3b3szqsph1dp2i2jqg0di1gr-nix-expr-2.27.0/lib/libnixexpr.so
| 16:20:44 |
Leonardo Santiago | * This is as much information as I can gather from gdb (showing only toplevel, the callstack is 22k calls deep), as I don't know how to enable debug information on the nix C API .so libraries, for some reason setting dontStrip = true doesn't work for the nix-{x}-c packages.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff6aaee5a in nix::ExprVar::eval(nix::EvalState&, nix::Env&, nix::Value&) ()
from /nix/store/8dlfn55w3b3szqsph1dp2i2jqg0di1gr-nix-expr-2.27.0/lib/libnixexpr.so
| 19:12:38 |
Robert Hensing (roberth) | Did you use .overrideAllMesonComponents ? | 22:07:19 |
6 Apr 2025 |
Leonardo Santiago | Nope, and not a particular weird version of nixpkgs. Stable one, tried both with nix 2.25 and now 2.27.0 and both of them showed the same error. | 20:34:29 |
Robert Hensing (roberth) | Hmm ok. For 2.27 you'd need it because of the libraries being separate derivations, but that's not an explanation for the 2.25 behavior fwiw | 22:11:08 |
Robert Hensing (roberth) | 2.27 is worth another try with that method, because it uses a different build system, so it might not have the 2.25 problem | 22:11:56 |
7 Apr 2025 |
Leonardo Santiago | what do you mean? What does .overrideAllMesonComponents do? | 14:05:11 |
Leonardo Santiago | * what do you mean? What does .overrideAllMesonComponents do and how am I supposed to use it? | 14:05:18 |
Leonardo Santiago | Okay, it finally clicked to me that the reason that I had no line number and source information was because I was compiling nix-expr without source information. When I managed to build it with debug information, it stopped segfaulting :D | 16:22:22 |
Leonardo Santiago | This is what I did, and if I change nix-expr-c for nix.libs.nix-expr-c it goes back to segfaulting
mkDebug = p: p.overrideAttrs (old: old // {
dontStrip = true;
mesonBuildType = "debugoptimized";
NIX_CFLAGS_COMPILE = toString (old.NIX_CFLAGS_COMPILE or "") + " -ggdb -Og";
});
nix-expr-c = (mkDebug nix.libs.nix-expr-c).override { nix-expr = mkDebug nix.libs.nix-expr; };
nix-deps = map mkDebug [ nix.libs.nix-store-c nix-expr-c nix.libs.nix-util-c ];
| 16:23:56 |
Leonardo Santiago | * This is what I did, and if I change nix-expr-c for nix.libs.nix-expr-c it goes back to segfaulting
inputs = {
nix.url` = "github:nixos/nix/2.27.0;
};
outputs = { ... } : {
...
nix = inputs.nix.packages.${system}.nix;
mkDebug = p: p.overrideAttrs (old: old // {
dontStrip = true;
mesonBuildType = "debugoptimized";
NIX_CFLAGS_COMPILE = toString (old.NIX_CFLAGS_COMPILE or "") + " -ggdb -Og";
});
nix-expr-c = (mkDebug nix.libs.nix-expr-c).override { nix-expr = mkDebug nix.libs.nix-expr; };
nix-deps = map mkDebug [ nix.libs.nix-store-c nix-expr-c nix.libs.nix-util-c ];
| 16:24:48 |
Leonardo Santiago | * This is what I did, and if I change nix-expr-c for nix.libs.nix-expr-c it goes back to segfaulting
inputs = {
nix.url` = "github:nixos/nix/2.27.0";
};
outputs = { ... } : {
...
nix = inputs.nix.packages.${system}.nix;
mkDebug = p: p.overrideAttrs (old: old // {
dontStrip = true;
mesonBuildType = "debugoptimized";
NIX_CFLAGS_COMPILE = toString (old.NIX_CFLAGS_COMPILE or "") + " -ggdb -Og";
});
nix-expr-c = (mkDebug nix.libs.nix-expr-c).override { nix-expr = mkDebug nix.libs.nix-expr; };
nix-deps = map mkDebug [ nix.libs.nix-store-c nix-expr-c nix.libs.nix-util-c ];
| 16:24:52 |
Leonardo Santiago | * This is what I did, and if I change nix-expr-c for nix.libs.nix-expr-c it goes back to segfaulting
inputs = {
nix.url = "github:nixos/nix/2.27.0";
};
outputs = { ... } : {
...
nix = inputs.nix.packages.${system}.nix;
mkDebug = p: p.overrideAttrs (old: old // {
dontStrip = true;
mesonBuildType = "debugoptimized";
NIX_CFLAGS_COMPILE = toString (old.NIX_CFLAGS_COMPILE or "") + " -ggdb -Og";
});
nix-expr-c = (mkDebug nix.libs.nix-expr-c).override { nix-expr = mkDebug nix.libs.nix-expr; };
nix-deps = map mkDebug [ nix.libs.nix-store-c nix-expr-c nix.libs.nix-util-c ];
| 16:24:58 |
Leonardo Santiago | Robert Hensing (roberth): Is this UB? | 16:27:29 |
Leonardo Santiago | * Robert Hensing (roberth): Could this be UB? | 16:41:45 |
Leonardo Santiago | Removing mesonBuildType and NIX_CFLAGS_COMPILE and keeping only dontStrip finally made it segfault with debug symbols:
#0 0x00007ffff68ac8d7 in nix::EvalState::callFunction (this=0x5b7b00, fun=..., args=..., vRes=..., pos=...) at <artificial>:1507
#1 0x00007ffff68b034c in nix::ExprCall::eval (this=0x648580, state=..., env=..., v=...) at ../stl_iterator.h:90
#2 0x00007ffff68af62b in nix::EvalState::forceValue (pos=..., v=..., this=0x5b7b00) at /build/source/src/libexpr/build/value.hh:96
#3 nix::ExprSelect::eval (this=0x648540, state=..., env=..., v=...) at <artificial>:1443
#4 0x00007ffff68af158 in nix::EvalState::forceValue (pos=..., v=..., this=0x5b7b00) at /build/source/src/libexpr/build/value.hh:96
#5 nix::ExprVar::eval (this=<optimized out>, state=..., env=..., v=...) at <artificial>:1372
#6 0x00007ffff68af3d9 in nix::ExprSelect::eval (this=0x17f49f0, state=..., env=..., v=...) at <artificial>:1402
#7 0x00007ffff68b0ed1 in nix::ExprOpConcatLists::eval (this=0x17f4a30, state=..., env=..., v=...) at <artificial>:1948
#8 0x00007ffff6905617 in nix::EvalState::forceValue (pos=..., v=..., this=<optimized out>, this=<optimized out>, v=..., pos=...)
at /nix/store/9c9h0zbqa9xfk6pk4387l1h9pj28r692-nix-util-2.27.0-dev/include/nix/aligned_buffer.h:96
#9 nix::EvalState::forceList (errorCtx=..., pos=..., v=..., this=<optimized out>, this=<optimized out>, v=..., pos=..., errorCtx=...)
at /nix/store/9c9h0zbqa9xfk6pk4387l1h9pj28r692-nix-util-2.27.0-dev/include/nix/aligned_buffer.h:136
#10 nix::prim_foldlStrict (state=..., pos=..., args=0x7fffff670c00, v=...) at /build/source/src/libexpr/build/new_allocator.h:3485
| 16:48:55 |
Robert Hensing (roberth) | I've never seen something like <artificial>:1507 before | 20:23:52 |