about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific/linux/firmware/fwupdate/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/firmware/fwupdate/default.nix')
-rw-r--r--nixpkgs/pkgs/os-specific/linux/firmware/fwupdate/default.nix19
1 files changed, 12 insertions, 7 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/firmware/fwupdate/default.nix b/nixpkgs/pkgs/os-specific/linux/firmware/fwupdate/default.nix
index c14e04dc3440..bcafa7f3376d 100644
--- a/nixpkgs/pkgs/os-specific/linux/firmware/fwupdate/default.nix
+++ b/nixpkgs/pkgs/os-specific/linux/firmware/fwupdate/default.nix
@@ -1,6 +1,13 @@
 { efivar, fetchurl, gettext, gnu-efi, libsmbios, pkgconfig, popt, stdenv }:
+
 let
   version = "12";
+
+  arch =
+    if stdenv.hostPlatform.isx86_32
+    then "ia32"
+    else stdenv.hostPlatform.parsed.cpu.name;
+
 in stdenv.mkDerivation {
   pname = "fwupdate";
   inherit version;
@@ -13,7 +20,11 @@ in stdenv.mkDerivation {
     ./do-not-create-sharedstatedir.patch
   ];
 
-  NIX_CFLAGS_COMPILE = "-I${gnu-efi}/include/efi -Wno-error=address-of-packed-member";
+  NIX_CFLAGS_COMPILE = builtins.toString [
+    "-I${gnu-efi}/include/efi"
+    "-I${gnu-efi}/include/efi/${arch}"
+    "-Wno-error=address-of-packed-member"
+  ];
 
   # TODO: Just apply the disable to the efi subdir
   hardeningDisable = [ "stackprotector" ];
@@ -41,12 +52,6 @@ in stdenv.mkDerivation {
     efivar
   ];
 
-  # TODO: fix wrt cross-compilation
-  preConfigure = ''
-    arch=$(cc -dumpmachine | cut -f1 -d- | sed 's,i[3456789]86,ia32,' )
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gnu-efi}/include/efi/$arch"
-  '';
-
   postInstall = ''
     rm -rf $out/src
     rm -rf $out/lib/debug