summary refs log tree commit diff
path: root/pkgs/os-specific/linux/firmware/fwupd/default.nix
diff options
context:
space:
mode:
authorMaxine Aubrey <maxeaubrey@gmail.com>2021-08-11 22:46:22 +0200
committerJan Tojnar <jtojnar@gmail.com>2021-11-05 12:01:46 +0100
commit0b546fc53f6487785dad1e0481d0b7d7073b9786 (patch)
tree580b4857dd75aaa8cfb004471e705206edba68b1 /pkgs/os-specific/linux/firmware/fwupd/default.nix
parent2b3c8211f7af3b7d0c14b0a91f3090cb977c93d6 (diff)
downloadnixpkgs-0b546fc53f6487785dad1e0481d0b7d7073b9786.tar
nixpkgs-0b546fc53f6487785dad1e0481d0b7d7073b9786.tar.gz
nixpkgs-0b546fc53f6487785dad1e0481d0b7d7073b9786.tar.bz2
nixpkgs-0b546fc53f6487785dad1e0481d0b7d7073b9786.tar.lz
nixpkgs-0b546fc53f6487785dad1e0481d0b7d7073b9786.tar.xz
nixpkgs-0b546fc53f6487785dad1e0481d0b7d7073b9786.tar.zst
nixpkgs-0b546fc53f6487785dad1e0481d0b7d7073b9786.zip
fwupd: 1.5.12 -> 1.7.1
- https://github.com/fwupd/fwupd/releases/tag/1.6.0
- https://github.com/fwupd/fwupd/releases/tag/1.6.1
- https://github.com/fwupd/fwupd/releases/tag/1.6.2
- https://github.com/fwupd/fwupd/releases/tag/1.6.3
- https://github.com/fwupd/fwupd/releases/tag/1.6.4
- https://github.com/fwupd/fwupd/releases/tag/1.7.0
- https://github.com/fwupd/fwupd/releases/tag/1.7.1

Installed tests python not needed since the utility was moved to C code:
https://github.com/fwupd/fwupd/commit/9d37e447a1dbd4c333c36c18eee2aa7472c8ca04

Co-Authored-By: Jan Tojnar <jtojnar@gmail.com>
Diffstat (limited to 'pkgs/os-specific/linux/firmware/fwupd/default.nix')
-rw-r--r--pkgs/os-specific/linux/firmware/fwupd/default.nix128
1 files changed, 70 insertions, 58 deletions
diff --git a/pkgs/os-specific/linux/firmware/fwupd/default.nix b/pkgs/os-specific/linux/firmware/fwupd/default.nix
index 4f3c3a79f5b..0333a9e4310 100644
--- a/pkgs/os-specific/linux/firmware/fwupd/default.nix
+++ b/pkgs/os-specific/linux/firmware/fwupd/default.nix
@@ -1,9 +1,10 @@
 # Updating? Keep $out/etc synchronized with passthru keys
 
-{ lib, stdenv
+{ stdenv
+, lib
 , fetchurl
+, fetchpatch
 , fetchFromGitHub
-, substituteAll
 , gtk-doc
 , pkg-config
 , gobject-introspection
@@ -15,13 +16,11 @@
 , sqlite
 , libarchive
 , curl
-, help2man
 , libjcat
 , libxslt
 , elfutils
 , libsmbios
 , efivar
-, gnu-efi
 , valgrind
 , meson
 , libuuid
@@ -31,6 +30,7 @@
 , ninja
 , gcab
 , gnutls
+, protobufc
 , python3
 , wrapGAppsHook
 , json-glib
@@ -40,32 +40,24 @@
 , vala
 , makeFontsConf
 , freefont_ttf
-, cairo
-, freetype
-, fontconfig
 , pango
 , tpm2-tss
 , bubblewrap
 , efibootmgr
 , flashrom
 , tpm2-tools
+, fwupd-efi
 , nixosTests
 , runCommand
+, unstableGitUpdater
 }:
 
 let
   python = python3.withPackages (p: with p; [
     pygobject3
-    pycairo
-    pillow
     setuptools
   ]);
 
-  installedTestsPython = python3.withPackages (p: with p; [
-    pygobject3
-    requests
-  ]);
-
   isx86 = stdenv.isx86_64 || stdenv.isi686;
 
   # Dell isn't supported on Aarch64
@@ -89,9 +81,38 @@ let
     exec python3 -c "$buildCommandPython"
   '';
 
+  test-firmware =
+    let
+      version = "unstable-2021-11-02";
+      src = fetchFromGitHub {
+        name = "fwupd-test-firmware-${version}";
+        owner = "fwupd";
+        repo = "fwupd-test-firmware";
+        rev = "aaa2f9fd68a40684c256dd85b86093cba38ffd9d";
+        sha256 = "Slk7CNfkmvmOh3WtIBkPs3NYT96co6i8PwqcbpeVFgA=";
+        passthru = {
+          inherit src version; # For update script
+          updateScript = unstableGitUpdater {
+            url = "${test-firmware.meta.homepage}.git";
+          };
+        };
+      };
+    in
+      src // {
+        meta = src.meta // {
+          # For update script
+          position =
+            let
+              pos = builtins.unsafeGetAttrPos "updateScript" test-firmware;
+            in
+            pos.file + ":" + toString pos.line;
+        };
+      };
+
+
   self = stdenv.mkDerivation rec {
     pname = "fwupd";
-    version = "1.5.12";
+    version = "1.7.1";
 
     # libfwupd goes to lib
     # daemon, plug-ins and libfwupdplugin go to out
@@ -100,27 +121,27 @@ let
 
     src = fetchurl {
       url = "https://people.freedesktop.org/~hughsient/releases/fwupd-${version}.tar.xz";
-      sha256 = "sha256-BluwLlm6s/2H/USARQpAvDR0+X8WP/q0h8VvxA6Qftc=";
+      sha256 = "sha256-rlbOtEt4byH1TRM6xwvF2cuM1L2gFnM5xmmiKNpn+jw=";
     };
 
     patches = [
-      # Do not try to create useless paths in /var.
-      ./fix-paths.patch
-
-      # Allow installing
+      # Since /etc is the domain of NixOS, not Nix,
+      # we cannot install files there.
+      # Let’s install the files to $prefix/etc
+      # while still reading them from /etc.
+      # NixOS module for fwupd will take take care of copying the files appropriately.
       ./add-option-for-installation-sysconfdir.patch
 
-      # Install plug-ins and libfwupdplugin to out,
+      # Install plug-ins and libfwupdplugin to $out output,
       # they are not really part of the library.
       ./install-fwupdplugin-to-out.patch
 
       # Installed tests are installed to different output
       # we also cannot have fwupd-tests.conf in $out/etc since it would form a cycle.
-      (substituteAll {
-        src = ./installed-tests-path.patch;
-        # Needs a different set of modules than po/make-images.
-        inherit installedTestsPython;
-      })
+      ./installed-tests-path.patch
+
+      # Tests detect fwupd is installed when prefix is /usr.
+      ./fix-install-detection.patch
     ];
 
     nativeBuildInputs = [
@@ -136,8 +157,8 @@ let
       gnutls
       docbook_xml_dtd_43
       docbook-xsl-nons
-      help2man
       libxslt
+      protobufc # for protoc
       python
       wrapGAppsHook
       vala
@@ -151,7 +172,6 @@ let
       libarchive
       curl
       elfutils
-      gnu-efi
       libgudev
       colord
       libjcat
@@ -159,18 +179,17 @@ let
       json-glib
       umockdev
       bash-completion
-      cairo
-      freetype
-      fontconfig
       pango
       tpm2-tss
       efivar
+      fwupd-efi
+      protobufc
     ] ++ lib.optionals haveDell [
       libsmbios
     ];
 
     mesonFlags = [
-      "-Dgtkdoc=true"
+      "-Ddocs=gtkdoc"
       "-Dplugin_dummy=true"
       # We are building the official releases.
       "-Dsupported_build=true"
@@ -180,17 +199,10 @@ let
       "-Dudevdir=lib/udev"
       "-Dsystemd_root_prefix=${placeholder "out"}"
       "-Dinstalled_test_prefix=${placeholder "installedTests"}"
-      "-Defi-libdir=${gnu-efi}/lib"
-      "-Defi-ldsdir=${gnu-efi}/lib"
-      "-Defi-includedir=${gnu-efi}/include/efi"
-      "-Defi_sbat_distro_id=nixos"
-      "-Defi_sbat_distro_summary=NixOS"
-      "-Defi_sbat_distro_pkgname=fwupd"
-      "-Defi_sbat_distro_version=${version}"
-      "-Defi_sbat_distro_url=https://search.nixos.org/packages?channel=unstable&show=fwupd&from=0&size=50&sort=relevance&query=fwupd"
       "--localstatedir=/var"
       "--sysconfdir=/etc"
       "-Dsysconfdir_install=${placeholder "out"}/etc"
+      "-Defi_os_dir=nixos"
 
       # We do not want to place the daemon into lib (cyclic reference)
       "--libexecdir=${placeholder "out"}/libexec"
@@ -232,13 +244,8 @@ let
 
     postPatch = ''
       patchShebangs \
-        contrib/get-version.py \
         contrib/generate-version-script.py \
         meson_post_install.sh \
-        plugins/uefi-capsule/efi/generate_sbat.py \
-        plugins/uefi-capsule/efi/generate_binary.py \
-        po/make-images \
-        po/make-images.sh \
         po/test-deps
     '';
 
@@ -246,18 +253,20 @@ let
       addToSearchPath XDG_DATA_DIRS "${shared-mime-info}/share"
     '';
 
-    postInstall =
-      let
-        testFw = fetchFromGitHub {
-          owner = "fwupd";
-          repo = "fwupd-test-firmware";
-          rev = "c13bfb26cae5f4f115dd4e08f9f00b3cb9acc25e";
-          sha256 = "US81i7mtLEe85KdWz5r+fQTk61IhqjVkzykBaBPuKL4=";
-        };
-      in ''
-        # These files have weird licenses so they are shipped separately.
-        cp --recursive --dereference "${testFw}/installed-tests/tests" "$installedTests/libexec/installed-tests/fwupd"
-      '';
+    preInstall = ''
+      # We have pkexec on PATH so Meson will try to use it when installation fails
+      # due to being unable to write to e.g. /etc.
+      # Let’s pretend we already ran pkexec –
+      # the pkexec on PATH would complain it lacks setuid bit,
+      # obscuring the underlying error.
+      # https://github.com/mesonbuild/meson/blob/492cc9bf95d573e037155b588dc5110ded4d9a35/mesonbuild/minstall.py#L558
+      export PKEXEC_UID=-1
+    '';
+
+    postInstall = ''
+      # These files have weird licenses so they are shipped separately.
+      cp --recursive --dereference "${test-firmware}/installed-tests/tests" "$installedTests/libexec/installed-tests/fwupd"
+    '';
 
     preFixup = let
       binPath = [
@@ -294,7 +303,6 @@ let
         "fwupd/remotes.d/vendor.conf"
         "fwupd/remotes.d/vendor-directory.conf"
         "fwupd/thunderbolt.conf"
-        "fwupd/upower.conf"
         "fwupd/uefi_capsule.conf"
         "pki/fwupd/GPG-KEY-Linux-Foundation-Firmware"
         "pki/fwupd/GPG-KEY-Linux-Vendor-Firmware-Service"
@@ -302,6 +310,7 @@ let
         "pki/fwupd-metadata/GPG-KEY-Linux-Foundation-Metadata"
         "pki/fwupd-metadata/GPG-KEY-Linux-Vendor-Firmware-Service"
         "pki/fwupd-metadata/LVFS-CA.pem"
+        "grub.d/35_fwupd"
       ] ++ lib.optionals haveDell [
         "fwupd/remotes.d/dell-esrt.conf"
       ] ++ lib.optionals haveRedfish [
@@ -315,6 +324,9 @@ let
         "invalid"
       ];
 
+      # For updating.
+      inherit test-firmware;
+
       tests = let
         listToPy = list: "[${lib.concatMapStringsSep ", " (f: "'${f}'") list}]";
       in {