How to update Nixos when system is idle?

Look into the options mentioned in Feature request: performance restricted rebuilds, particularly the nix.daemonCPUSched* options.