Nixos-switch rebuild quite long to run restarting

When I run nixos-rebuild switch without anything new, it takes like 4s to start printing setting up /etc (so to finish building)… but then it takes 1mn40s just to run restarting

$ time sudo nixos-rebuild switch
warning: Git tree '/etc/nixos' is dirty
building the system configuration...
warning: Git tree '/etc/nixos' is dirty
activating the configuration...
setting up /etc...
reloading user units for leo...
sudo nixos-rebuild switch  0,01s user 0,01s system 0% cpu 1:40,76 total

This is a really long time for not much, which is annoyingly long when we need to apply many changes to our configuration sequentially.

Is it normal? Why is it taking so long? It seems like it would be more efficient to just reboot to apply the changes :stuck_out_tongue: Is there any plan to make this faster somehow?

1 Like

Same problem. The transaction was much faster just several months ago. I personally uninstalled NixOS then, and now can’t find what happened during that interval.