this post was submitted on 20 Jun 2026
1 points (100.0% liked)

Nix / NixOS

2782 readers
5 users here now

Main links

Videos

founded 3 years ago
MODERATORS
 

Sorry if this is an ignorant question. I love Nix, but as a user it feels absurd that changing an option from true to false in a home-manager managed config file that then gets transpiled from Nix to TOML, for instance, takes like 10 seconds on a decently modern machine.

In my world that kind of transpilation should be instant. I get that there's more happening behind the scenes than just doing Nix -> TOML, but still. Imagine if the transpilation of config files were instant, so you could have home-manager automagically do the transpilation every time you save the file. That would be awesome, especially for programs that support hot-reloading like Hyprland or Niri.

Is this a Nix issue or a home-manager issue? How much of speedup would it yield to rewrite Nix and/or home-manager in a faster language like Zig or Rust?

you are viewing a single comment's thread
view the rest of the comments
[–] Corbin@programming.dev 0 points 10 hours ago

CppNix isn't slow because of C++, it's slow because its evaluation strategy (tree-walking an AST without any optimizations) is slow. Rewriting in Zig or Rust will not necessarily help; the structure of the compiler needs to be better. That said, Tvix is a Rust rewrite which uses a bytecode interpreter, and it is faster, but it's not a drop-in replacement like Lix. I prototyped a faster evaluator in RPython; see this LixCon 2026 video for my summarized notes to the Lix community.

Nix store transactions will never be instant. You've probably never thought about atomicity and durability for your configuration-file edits, but it's a desirable thing, right? Nix writes to a SQLite database for every transaction. This is not going to be a big part of your runtime as long as CppNix is so slow at evaluation, but it's the reason why trivial builds, like your derivations that merely copy text to the Nix store, take so long.