lol
1{ efivar, fetchurl, gettext, gnu-efi, libsmbios, pkgconfig, popt, stdenv }:
2let
3 version = "12";
4in stdenv.mkDerivation {
5 name = "fwupdate-${version}";
6 src = fetchurl {
7 url = "https://github.com/rhinstaller/fwupdate/releases/download/${version}/fwupdate-${version}.tar.bz2";
8 sha256 = "00w7jsg7wrlq4cpfz26m9rbv2jwyf0sansf343vfq02fy5lxars1";
9 };
10
11 patches = [
12 ./do-not-create-sharedstatedir.patch
13 ];
14
15 NIX_CFLAGS_COMPILE = [ "-I${gnu-efi}/include/efi" ];
16
17 # TODO: Just apply the disable to the efi subdir
18 hardeningDisable = [ "stackprotector" ];
19
20 makeFlags = [
21 "EFIDIR=nixos"
22 "prefix=$(out)"
23 "LIBDIR=$(out)/lib"
24 "GNUEFIDIR=${gnu-efi}/lib"
25 "ESPMOUNTPOINT=$(out)/boot"
26 ];
27
28 nativeBuildInputs = [
29 pkgconfig
30 gettext
31 ];
32
33 buildInputs = [
34 gnu-efi
35 libsmbios
36 popt
37 ];
38
39 propagatedBuildInputs = [
40 efivar
41 ];
42
43 # TODO: fix wrt cross-compilation
44 preConfigure = ''
45 arch=$(cc -dumpmachine | cut -f1 -d- | sed 's,i[3456789]86,ia32,' )
46 export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gnu-efi}/include/efi/$arch"
47 '';
48
49 postInstall = ''
50 rm -rf $out/src
51 rm -rf $out/lib/debug
52 '';
53
54 meta = with stdenv.lib; {
55 description = "Tools for using the ESRT and UpdateCapsule() to apply firmware updates";
56 maintainers = with maintainers; [ ];
57 license = licenses.gpl2;
58 platforms = platforms.linux;
59 };
60}