From 629624bb25eecb3a984695f76c3763f8d2969dfe Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sun, 5 Nov 2023 11:40:26 +0000 Subject: [PATCH] replace multiway if with pkgs.stdenv.hostPlatform.qemuArch --- modules/outputs.nix | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/modules/outputs.nix b/modules/outputs.nix index ae92bbf..61c4efa 100644 --- a/modules/outputs.nix +++ b/modules/outputs.nix @@ -7,12 +7,6 @@ let inherit (lib) mkOption types concatStringsSep; inherit (pkgs) liminix callPackage writeText; - arch = let s = pkgs.stdenv; in - if s.isAarch64 - then "aarch64" - else if s.isMips - then "mips" - else throw "can't determine arch"; in { imports = [ @@ -87,8 +81,8 @@ in let cmdline = builtins.toJSON (concatStringsSep " " config.boot.commandLine); makeBootableImage = pkgs.runCommandCC "objcopy" {} - (if pkgs.stdenv.isAarch64 - then "${pkgs.stdenv.cc.targetPrefix}objcopy -O binary -S ${kernel} $out" + (if pkgs.stdenv.hostPlatform.isAarch + then "${pkgs.stdenv.cc.targetPrefix}objcopy -O binary -R .comment -S ${kernel} $out" else "cp ${kernel} $out"); in pkgs.runCommandCC "vmroot" {} '' mkdir $out @@ -100,7 +94,7 @@ in echo ${cmdline} > commandline cat > run.sh << EOF #!${pkgs.runtimeShell} - CMDLINE=${cmdline} ${pkgs.pkgsBuildBuild.run-liminix-vm}/bin/run-liminix-vm --arch ${arch} \$* ${makeBootableImage} ${config.system.outputs.rootfs} + CMDLINE=${cmdline} ${pkgs.pkgsBuildBuild.run-liminix-vm}/bin/run-liminix-vm --arch ${pkgs.stdenv.hostPlatform.qemuArch} \$* ${makeBootableImage} ${config.system.outputs.rootfs} EOF chmod +x run.sh '';