2017-02-27 13:35:08 +00:00
|
|
|
{ stdenv, fetchurl, gnu-efi, efivar, libsmbios, popt, pkgconfig
|
|
|
|
, gettext }:
|
|
|
|
let version = "8"; in
|
|
|
|
stdenv.mkDerivation
|
|
|
|
{ name = "fwupdate-${version}";
|
|
|
|
src = fetchurl
|
|
|
|
{ url = "https://github.com/rhinstaller/fwupdate/releases/download/${version}/fwupdate-${version}.tar.bz2";
|
|
|
|
sha256 = "10q8k1kghvbcb5fwcl2smzp8vqdfzimx9dkk0c3hz39py1phy4n8";
|
|
|
|
};
|
|
|
|
makeFlags =
|
|
|
|
[ "EFIDIR=nixos"
|
|
|
|
"LIBDIR=$(out)/lib"
|
|
|
|
"GNUEFIDIR=${gnu-efi}/lib"
|
|
|
|
"TARGETDIR=$(out)/boot/efi/nixos/"
|
|
|
|
"prefix=$(out)/"
|
|
|
|
];
|
2017-09-05 22:26:13 +01:00
|
|
|
nativeBuildInputs = [ pkgconfig ];
|
|
|
|
buildInputs = [ gnu-efi libsmbios popt gettext ];
|
2017-02-27 13:35:08 +00:00
|
|
|
propagatedBuildInputs = [ efivar ];
|
|
|
|
# TODO: Just apply the disable to the efi subdir
|
2017-08-28 19:56:08 +01:00
|
|
|
hardeningDisable = [ "all" ];
|
2017-02-27 13:35:08 +00:00
|
|
|
patchPhase = ''
|
|
|
|
sed -i 's|/usr/include/smbios_c/token.h|smbios_c/token.h|' \
|
|
|
|
linux/libfwup.c
|
|
|
|
sed -i 's|/usr/share|$(prefix)share|' linux/Makefile
|
|
|
|
sed -i "s|/usr/include|$out/include|" linux/fwup.pc.in
|
2017-09-03 01:00:20 +01:00
|
|
|
find . -type f -print0 | xargs -0 sed -i -e 's|/boot/efi|/boot|g' -e 's|/boot/efi/EFI|/boot/EFI|g'
|
2017-02-27 13:35:08 +00:00
|
|
|
'';
|
|
|
|
configurePhase = ''
|
|
|
|
arch=$(cc -dumpmachine | cut -f1 -d- | sed 's,i[3456789]86,ia32,' )
|
|
|
|
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gnu-efi}/include/efi -I${efivar}/include/efivar -I${gnu-efi}/include/efi/$arch"
|
|
|
|
'';
|
|
|
|
meta =
|
|
|
|
{ license = [ stdenv.lib.licenses.gpl2 ];
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
|
|
|
};
|
|
|
|
}
|