diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl index eef81d81484e..3128d1db0987 100644 --- a/nixos/modules/system/boot/loader/grub/install-grub.pl +++ b/nixos/modules/system/boot/loader/grub/install-grub.pl @@ -199,7 +199,10 @@ sub GrubFs { return Grub->new(path => $path, search => $search); } my $grubBoot = GrubFs("/boot"); -my $grubStore = GrubFs("/nix/store"); +my $grubStore; +if ($copyKernels == 0) { + my $grubStore = GrubFs("/nix/store"); +} # Generate the header. my $conf .= "# Automatically generated. DO NOT EDIT THIS FILE!\n";