summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Nikolaenko <ivan.nikolaenko@unikie.com>2022-09-27 15:10:45 +0300
committerAlyssa Ross <hi@alyssa.is>2022-09-29 08:02:35 +0000
commitf2518402378a2825ebb750337a1a7adedde1132a (patch)
treee55377a37b28282862d60276dd5719708b70a0c5
parentf78fb2153c127fb78a3d77c4f773017b1ec08017 (diff)
lib/systems/default.nix: add efiArch suffixes
Move already implemented functionality to the upper level so it could be used in a more generic way. Signed-off-by: Ivan Nikolaenko <ivan.nikolaenko@unikie.com>
-rw-r--r--lib/systems/default.nix8
-rw-r--r--nixos/modules/installer/cd-dvd/iso-image.nix20
2 files changed, 15 insertions, 13 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index 6e494fce69b2..233174d40831 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -141,6 +141,14 @@ rec {
powerpc64le = "ppc64le";
}.${final.parsed.cpu.name} or final.parsed.cpu.name;
+ # Name used by UEFI for architectures.
+ efiArch =
+ if final.isx86_32 then "ia32"
+ else if final.isx86_64 then "x64"
+ else if final.isAarch32 then "arm"
+ else if final.isAarch64 then "aa64"
+ else final.parsed.cpu.name;
+
darwinArch = {
armv7a = "armv7";
aarch64 = "arm64";
diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix
index 6d0a11b7491f..8b8786cd3728 100644
--- a/nixos/modules/installer/cd-dvd/iso-image.nix
+++ b/nixos/modules/installer/cd-dvd/iso-image.nix
@@ -53,6 +53,13 @@ let
image = "/boot/${config.system.boot.loader.kernelFile}";
initrd = "/boot/initrd";
};
+
+ targetArch =
+ if config.boot.loader.grub.forcei686 then
+ "ia32"
+ else
+ stdenv.hostPlatform.efiArch;
+
in
menuBuilderGrub2
finalCfg
@@ -431,19 +438,6 @@ let
fsck.vfat -vn "$out"
''; # */
- # Name used by UEFI for architectures.
- targetArch =
- if pkgs.stdenv.isi686 || config.boot.loader.grub.forcei686 then
- "ia32"
- else if pkgs.stdenv.isx86_64 then
- "x64"
- else if pkgs.stdenv.isAarch32 then
- "arm"
- else if pkgs.stdenv.isAarch64 then
- "aa64"
- else
- throw "Unsupported architecture";
-
# Syslinux (and isolinux) only supports x86-based architectures.
canx86BiosBoot = pkgs.stdenv.hostPlatform.isx86;