nixos-rebuild: Sync /nix/store only

We only care about /nix/store because its contents might be out of
sync with /nix/var/nix/db. Syncing other filesystems might cause
unnecessary delays or hangs (e.g. I encountered a case where an NFS
mount was taking a very long time to sync).
This commit is contained in:
Eelco Dolstra 2017-03-03 15:21:42 +01:00
parent 044c7d091b
commit 136f77b7b9
No known key found for this signature in database
GPG Key ID: 8170B4726D7198DE

View File

@ -41,7 +41,7 @@ if ($action eq "switch" || $action eq "boot") {
}
# Just in case the new configuration hangs the system, do a sync now.
system("@coreutils@/bin/sync") unless ($ENV{"NIXOS_NO_SYNC"} // "") eq "1";
system("@coreutils@/bin/sync", "-f", "/nix/store") unless ($ENV{"NIXOS_NO_SYNC"} // "") eq "1";
exit 0 if $action eq "boot";