| 15 Aug 2025 |
Sergei Zimmerman (xokdvium) | You can also do nix build -f . checks.x86_64-linux.nix-fetchers-tests-run, since we are using flake-compat | 15:55:14 |
Sergei Zimmerman (xokdvium) | Or (nix-build) | 15:55:30 |
Sergei Zimmerman (xokdvium) | * Or nix-build | 15:55:36 |
fzakaria | it assumes it was installed on the system ? So Nix installed via the system will install the shared libraries and headers or is there a -dev version needed. | 15:56:09 |
fzakaria | (If i were to use Nix as a buildInput) | 15:56:21 |
Sergei Zimmerman (xokdvium) | Corresponding components install the .pc files to dev output | 15:56:50 |
fzakaria | cool okay I see the pc files in nix.dev store and they point to the nix lib directory | 16:01:51 |
fzakaria | (Not sure how someone gets these files without using nix itself but maybe that's by design :P ) | 16:02:29 |
fzakaria | Interesting, locally
nix build .#checks.x86_64-linux.nix-fetchers-tests-run passes but on CI it fails.
> The program must call nix::initNix() before calling any libstore library functions. | 16:03:56 |
fzakaria |  Download image.png | 16:08:44 |
fzakaria | Also, CLion to debug live Nix has been amazing; unfortunately the GoogleTest integration doesn't work -- doesn't seem to hydrate the "Target"
| 16:08:45 |
Sergei Zimmerman (xokdvium) | Yeah that's pretty unfortunate, but the order of tests matters. It means that locally there's a test that has initialized libstore already | 16:30:20 |
Sergei Zimmerman (xokdvium) | Can't help here, since I don't have jetbrains stuff | 16:30:53 |
Sergei Zimmerman (xokdvium) | You'd need to use the new nixComponents packaging. It makes it so you can use the libs without bringing the cli with them | 16:32:00 |
fzakaria | ty for the answers! | 20:34:03 |
fzakaria | i recommend the jetbrains stuff; having the gdb integrated debugger has made investigating issues 100x easier | 20:34:19 |
fzakaria | I might invest in trying to get rr working too | 20:34:25 |
| 16 Aug 2025 |
connor (burnt/out) (UTC-8) | Does anyone have any recommended tooling for finding out what values are being kept around by the GC (as well as why they’re being kept around)? | 00:31:11 |
dramforever | nix-store --gc --print-roots | 04:53:02 |
connor (burnt/out) (UTC-8) | Sorry, I should have disambiguated -- Boehm GC | 04:54:09 |
dramforever | lol | 04:54:15 |
dramforever | oops | 04:54:20 |
Sergei Zimmerman (xokdvium) | In reply to @connorbaker:matrix.org Sorry, I should have disambiguated -- Boehm GC IFAIK there isn’t a lot of tooling for this. Boehm has some stuff to collect stats, but other than that I imagine you’d have to write custom tools for that. | 06:57:23 |
connor (burnt/out) (UTC-8) | I’ll post a small reproducer tomorrow of unexpected behavior I’m seeing with respect to the GC not freeing memory when I think it should be able to; I’d love to hear people’s thoughts on what could be causing it! | 06:59:36 |
connor (burnt/out) (UTC-8) | Thank you for the PR shrinking the Value struct by the way, that was great! | 07:00:55 |
Sergei Zimmerman (xokdvium) | In reply to @connorbaker:matrix.org I’ll post a small reproducer tomorrow of unexpected behavior I’m seeing with respect to the GC not freeing memory when I think it should be able to; I’d love to hear people’s thoughts on what could be causing it! That would be great to see. Honestly it’d be nice to actually hunker down and write the tooling that we need for GC debugging/visualization. Hit me up if you would like to work on that.
How’s the Immer thing going btw? | 07:06:35 |
Mic92 | In reply to @fzakaria:one.ems.host Also, CLion to debug live Nix has been amazing; unfortunately the GoogleTest integration doesn't work -- doesn't seem to hydrate the "Target" Try raise(SIGTRAP); inside gtest | 12:12:05 |
Mic92 | Or this https://github.com/nemequ/portable-snippets/blob/master/debug-trap/debug-trap.h | 12:13:10 |
connor (burnt/out) (UTC-8) | I've got a file temp.nix with this expression:
let
numClosures = 1;
nixpkgsPath =
(builtins.getFlake "github:NixOS/nixpkgs/42a63d6a63c0ae7d715e46450fe5a5f69394525d").outPath;
in
builtins.genList (
_:
let
drvPath' = (import (nixpkgsPath + "/nixos/release.nix") { }).closures.gnome.x86_64-linux.drvPath;
in
builtins.deepSeq drvPath' drvPath'
) numClosures
I ran nix eval by way of
/usr/bin/env time -v env GC_INITIAL_HEAP_SIZE=512M GC_MAXIMUM_HEAP_SIZE=512M GC_PRINT_STATS=1 NIX_SHOW_STATS=1 nix eval --json --expr "$(cat temp.nix)"
and kept lowering the maximum GC size until it would OOM with a numClosures = 1 (that's how I arrived at 512M). My expectation is that 512M should be sufficient to evaluate many copies of that closure, given I'm taking only the drvPath, and the only increase in memory usage I'd expect between the first and second evaluation of the closure is that the evaluator has allocated memory for the list of derivations it's going to print as JSON. However, when I use numClosures = 2, I OOM. Keeping everything same, I bumped it up to 1G of memory, and I still OOM with numClosures = 2.
One thing which could be tested is to create a large expression in the same fashion, without using import, to see if that has a different memory profile.
| 19:01:26 |
connor (burnt/out) (UTC-8) | I would also like such tooling, but I really don't like reading or writing C/C++ :(
I've only ever read/written C/C++ in anger and I very much consider myself incompetent with C/C++
I haven't looked at or touched the Immer stuff in a long while; the biggest road blocks I saw to moving forward with it were:
- the issue where the GC would still collect values while they were needed
- creating wrappers around lists/bindings to abstract over the implementation (and the changes that would cause to the C API), although I think you did or started this with your
Value refactoring
- rewriting relevant portions of the evaluator to use the different implementations offered by Immer (using the mutable APIs where appropriate)
- making changes to the stats reported by the Nix evaluator
- the lack of any sort of benchmark suite or platform on which to benchmark making it hard to discern what exactly changed and how
I think 1. was being looked at by the author of Immer, not sure whether they ever got the chance to get into it; 2. and 5. should happen regardless as a code/project hygiene thing.
Fundamentally I still think it's important we look at the data structures Nix offers, the ways in which those data structures are most commonly used, and implementations that make those operations fast :l
| 19:20:50 |