Print which host is being built
noonien opened this issue · 4 comments
When doing remote builds with flakes, sometimes it's not obvious which host is being built. --flake .
might build the wrong host. The fix for this is usually just to use --flake .#host
, however, if you nixos-rebuild switch, it might have already switched to the wrong configuration.
In the past, before using flake-utils-plus, i just had builtins.trace "building ${name}" <actual builder>
, which did the job.
Even though I think this might be a good idea, others may disagree. So it would be nice to either be able just opt-in to this, or just be able to setup a default builder, and not have to define a builder for each host.
If I'm not mistaken you could do
hostDefaults.builder = builtins.trace "building ${name}" <actual builder>
I am not sure what is the solution here. @noonien what do you think is the correct way of implementing it?
I've currently removed the builtins.trace
from my nix files, and print which host is being built in my own deploy script. But I believe fufexan's solution might be good enough, perhaps as an opt-out default?
I like it. I plan on using a single flake for about 10 servers. I'm sure I'll mess things up sooner or later, at least this will help me catch mistakes early.