about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2020-02-05 00:22:35 +0100
committerGitHub <noreply@github.com>2020-02-05 00:22:35 +0100
commitb4cc4139284e2cd73ed5c19761b081bebc6d51db (patch)
tree166a7910a3d9c86a09a04d0b939aa1172f537799
parentb27f806da8e4dda50d4ad6061b4afbccdfbd922b (diff)
parent7144b9ac5417c6e74af41fd3c6cad8e20ffc369c (diff)
downloadnixlib-b4cc4139284e2cd73ed5c19761b081bebc6d51db.tar
nixlib-b4cc4139284e2cd73ed5c19761b081bebc6d51db.tar.gz
nixlib-b4cc4139284e2cd73ed5c19761b081bebc6d51db.tar.bz2
nixlib-b4cc4139284e2cd73ed5c19761b081bebc6d51db.tar.lz
nixlib-b4cc4139284e2cd73ed5c19761b081bebc6d51db.tar.xz
nixlib-b4cc4139284e2cd73ed5c19761b081bebc6d51db.tar.zst
nixlib-b4cc4139284e2cd73ed5c19761b081bebc6d51db.zip
Merge pull request #77594 from Frostman/fix-grub-extrafiles-mirroredboots
Fix boot.loader.grub.extraFiles when used with mirroredBoots
-rw-r--r--nixos/modules/system/boot/loader/grub/grub.nix2
-rw-r--r--nixos/modules/system/boot/loader/grub/install-grub.pl3
2 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix
index 9a4db84f7b73..26c1197bf975 100644
--- a/nixos/modules/system/boot/loader/grub/grub.nix
+++ b/nixos/modules/system/boot/loader/grub/grub.nix
@@ -630,7 +630,7 @@ in
 
       boot.loader.grub.extraPrepareConfig =
         concatStrings (mapAttrsToList (n: v: ''
-          ${pkgs.coreutils}/bin/cp -pf "${v}" "/boot/${n}"
+          ${pkgs.coreutils}/bin/cp -pf "${v}" "@bootPath@/${n}"
         '') config.boot.loader.grub.extraFiles);
 
       assertions = [
diff --git a/nixos/modules/system/boot/loader/grub/install-grub.pl b/nixos/modules/system/boot/loader/grub/install-grub.pl
index a09c5dc47618..ca0fb0248e0e 100644
--- a/nixos/modules/system/boot/loader/grub/install-grub.pl
+++ b/nixos/modules/system/boot/loader/grub/install-grub.pl
@@ -475,6 +475,9 @@ if ($grubVersion == 2) {
     }
 }
 
+# extraPrepareConfig could refer to @bootPath@, which we have to substitute
+$extraPrepareConfig =~ s/\@bootPath\@/$bootPath/g;
+
 # Run extraPrepareConfig in sh
 if ($extraPrepareConfig ne "") {
   system((get("shell"), "-c", $extraPrepareConfig));