lol
1{ stdenv, fetchurl, fetchpatch, gtk-doc, pkgconfig, gobjectIntrospection, intltool
2, libgudev, polkit, appstream-glib, gusb, sqlite, libarchive, glib-networking
3, libsoup, help2man, gpgme, libxslt, elfutils, libsmbios, efivar, glibcLocales
4, fwupdate, libyaml, valgrind, meson, libuuid, colord, docbook_xml_dtd_43, docbook_xsl
5, ninja, gcab, gnutls, python3, wrapGAppsHook, json-glib
6, shared-mime-info, umockdev
7}:
8let
9 # Updating? Keep $out/etc synchronized with passthru.filesInstalledToEtc
10 version = "1.0.5";
11 python = python3.withPackages (p: with p; [ pygobject3 pycairo pillow ]);
12 installedTestsPython = python3.withPackages (p: with p; [ pygobject3 requests ]);
13in stdenv.mkDerivation {
14 name = "fwupd-${version}";
15 src = fetchurl {
16 url = "https://people.freedesktop.org/~hughsient/releases/fwupd-${version}.tar.xz";
17 sha256 = "0wm195vkf6x1kg1dz0sbfwpdcn9f6638l7vyzplcfrb3v07pqxpq";
18 };
19
20 outputs = [ "out" "devdoc" "man" "installedTests" ];
21
22 nativeBuildInputs = [
23 meson ninja gtk-doc pkgconfig gobjectIntrospection intltool glibcLocales shared-mime-info
24 valgrind gcab docbook_xml_dtd_43 docbook_xsl help2man libxslt python wrapGAppsHook
25 ];
26 buildInputs = [
27 polkit appstream-glib gusb sqlite libarchive libsoup elfutils libsmbios fwupdate libyaml
28 libgudev colord gpgme libuuid gnutls glib-networking efivar json-glib umockdev
29 ];
30
31 LC_ALL = "en_US.UTF-8"; # For po/make-images
32
33 patches = [
34 ./fix-missing-deps.patch
35 (fetchpatch {
36 url = https://github.com/hughsie/fwupd/commit/767210e4b1401d5d5bb7ac1e7c052a60b6529d88.patch;
37 sha256 = "00adfabxpgdg74jx7i6jihhh8njjk2r7v3fxqs4scj3vn06k5fmw";
38 })
39 ];
40
41 postPatch = ''
42 # needs a different set of modules than po/make-images
43 escapedInterpreterLine=$(echo "${installedTestsPython}/bin/python3" | sed 's|\\|\\\\|g')
44 sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" data/installed-tests/hardware.py
45
46 patchShebangs .
47 substituteInPlace data/installed-tests/fwupdmgr.test.in --subst-var-by installedtestsdir "$installedTests/share/installed-tests/fwupd"
48 '';
49
50 doCheck = true;
51
52 preFixup = ''
53 gappsWrapperArgs+=(--prefix XDG_DATA_DIRS : "${shared-mime-info}/share")
54 '';
55
56 mesonFlags = [
57 "-Dplugin_dummy=true"
58 "-Dbootdir=/boot"
59 "-Dudevdir=lib/udev"
60 "-Dsystemdunitdir=lib/systemd/system"
61 "--localstatedir=/var"
62 ];
63
64 postInstall = ''
65 moveToOutput share/installed-tests "$installedTests"
66 wrapProgram $installedTests/share/installed-tests/fwupd/hardware.py \
67 --prefix GI_TYPELIB_PATH : "$out/lib/girepository-1.0:${libsoup}/lib/girepository-1.0"
68 '';
69
70 passthru = {
71 filesInstalledToEtc = [
72 "fwupd/remotes.d/fwupd.conf"
73 "fwupd/remotes.d/lvfs-testing.conf"
74 "fwupd/remotes.d/lvfs.conf"
75 "fwupd/remotes.d/vendor.conf"
76 "pki/fwupd/GPG-KEY-Hughski-Limited"
77 "pki/fwupd/GPG-KEY-Linux-Vendor-Firmware-Service"
78 "pki/fwupd/LVFS-CA.pem"
79 "pki/fwupd-metadata/GPG-KEY-Linux-Vendor-Firmware-Service"
80 "pki/fwupd-metadata/LVFS-CA.pem"
81 ];
82 };
83
84 meta = with stdenv.lib; {
85 homepage = https://fwupd.org/;
86 maintainers = with maintainers; [];
87 license = [ licenses.gpl2 ];
88 platforms = platforms.linux;
89 };
90}