Best way to manually test changes to the nix binary?

I recently made a small change to the nix binary (see Help the user debug "illegal path references in fixed-output derivation" · Issue #11673 · NixOS/nix · GitHub), but had a bit of a frustrating time seeing what it looked like because if I used my new nix binary to do a nix-build, it would ask the nix daemon (running the unchanged code) to do it instead, so my change wouldn’t be effective. If I killed the daemon, removed its socket, and then ran the command as root, my changes were visible.

The man page for nix-store --realise (which is what I was using) suggests that NIX_REMOTE needs to be set to daemon (or the socket URI) to use the daemon, but it seems to be using the daemon even when that variable is not set, or is set to an invalid value.

Obviously also having to run my nix commands as root is a little sad. It would be cool if I could have the command read from my “real” nix store, but write to (and ideally, also read from) a different, temporary one, but maybe that’s too much complexity given this relatively niche use case?

Do other people working on changes to nix have some other workflow?

1 Like