From a8ac36d4a49bd50658fb6211c5c3fea85069bbed Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 14 Feb 2025 14:22:51 +0100 Subject: [PATCH 1/6] fwupd: 2.0.5 -> 2.0.6 Diff: https://github.com/fwupd/fwupd/compare/refs/tags/2.0.5...2.0.6 Changelog: https://github.com/fwupd/fwupd/releases/tag/2.0.6 --- pkgs/by-name/fw/fwupd/package.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/fw/fwupd/package.nix b/pkgs/by-name/fw/fwupd/package.nix index e378de515de1..a0c065d029c2 100644 --- a/pkgs/by-name/fw/fwupd/package.nix +++ b/pkgs/by-name/fw/fwupd/package.nix @@ -117,7 +117,7 @@ let in stdenv.mkDerivation (finalAttrs: { pname = "fwupd"; - version = "2.0.5"; + version = "2.0.6"; # libfwupd goes to lib # daemon, plug-ins and libfwupdplugin go to out @@ -135,7 +135,7 @@ stdenv.mkDerivation (finalAttrs: { owner = "fwupd"; repo = "fwupd"; tag = finalAttrs.version; - hash = "sha256-V07alPn2+bOkKx+oh8qoX4Ie6/5ujO6h/TDzvL3UhvQ="; + hash = "sha256-//y2kkCrj6E3kKxZIEK2bBUiZezB9j4xzR6WrBdcpqQ="; }; patches = [ From 214188ecff138abe133ded41cb25a01340e300bd Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 14 Feb 2025 14:25:34 +0100 Subject: [PATCH 2/6] fwupd: use writableTmpDirAsHomeHook --- pkgs/by-name/fw/fwupd/package.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/by-name/fw/fwupd/package.nix b/pkgs/by-name/fw/fwupd/package.nix index a0c065d029c2..280e1dfccc85 100644 --- a/pkgs/by-name/fw/fwupd/package.nix +++ b/pkgs/by-name/fw/fwupd/package.nix @@ -6,6 +6,7 @@ lib, fetchFromGitHub, gi-docgen, + writableTmpDirAsHomeHook, pkg-config, gobject-introspection, gettext, @@ -182,6 +183,9 @@ stdenv.mkDerivation (finalAttrs: { vala gobject-introspection gi-docgen + + # jcat-tool at buildtime requires a home directory + writableTmpDirAsHomeHook ] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ mesonEmulatorHook @@ -287,11 +291,6 @@ stdenv.mkDerivation (finalAttrs: { sed -i "s/get_option('tests')/false/" plugins/redfish/meson.build ''; - preBuild = '' - # jcat-tool at buildtime requires a home directory - export HOME="$(mktemp -d)" - ''; - preCheck = '' addToSearchPath XDG_DATA_DIRS "${shared-mime-info}/share" From 01848154d52032cfe2dd5e0c5b2610cfdc669c77 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 14 Feb 2025 14:32:56 +0100 Subject: [PATCH 3/6] fwupd: cleanup --- pkgs/by-name/fw/fwupd/package.nix | 171 +++++++++++++++++------------- 1 file changed, 96 insertions(+), 75 deletions(-) diff --git a/pkgs/by-name/fw/fwupd/package.nix b/pkgs/by-name/fw/fwupd/package.nix index 280e1dfccc85..e32f777a56fb 100644 --- a/pkgs/by-name/fw/fwupd/package.nix +++ b/pkgs/by-name/fw/fwupd/package.nix @@ -1,59 +1,82 @@ # Updating? Keep $out/etc synchronized with passthru keys { - pkgsBuildBuild, - stdenv, lib, - fetchFromGitHub, - gi-docgen, - writableTmpDirAsHomeHook, - pkg-config, - gobject-introspection, - gettext, - libgudev, - libdrm, - polkit, - libxmlb, - gusb, - sqlite, - libarchive, - libredirect, - curl, - libjcat, - elfutils, - valgrind, - meson, - mesonEmulatorHook, - libuuid, - ninja, - gnutls, - protobufc, + stdenv, + + # runPythonCommand + runCommand, python3, - wrapGAppsNoGuiHook, - ensureNewerSourcesForZipFilesHook, + + # test-firmware + fetchFromGitHub, + unstableGitUpdater, + + # fwupd + pkg-config, + pkgsBuildBuild, + + # propagatedBuildInputs json-glib, - bash-completion, + + # nativeBuildInputs + ensureNewerSourcesForZipFilesHook, + gettext, + gi-docgen, + gobject-introspection, + meson, + ninja, + protobufc, shared-mime-info, vala, + wrapGAppsNoGuiHook, + writableTmpDirAsHomeHook, + mesonEmulatorHook, + + # buildInputs + bash-completion, + curl, + elfutils, + fwupd-efi, + gnutls, + gusb, + libarchive, + libcbor, + libdrm, + libgudev, + libjcat, + libmbim, + libqmi, + libuuid, + libxmlb, + modemmanager, + pango, + polkit, + sqlite, + tpm2-tss, + valgrind, + xz, # for liblzma + flashrom, + + # mesonFlags + hwdata, + + # env makeFontsConf, freefont_ttf, - pango, - tpm2-tss, + + # preCheck + libredirect, + + # preFixup bubblewrap, efibootmgr, - flashrom, tpm2-tools, - fwupd-efi, + + # passthru nixosTests, - runCommand, - unstableGitUpdater, - modemmanager, - libqmi, - libmbim, - libcbor, - xz, - hwdata, nix-update-script, + enableFlashrom ? false, enablePassim ? false, }: @@ -159,6 +182,16 @@ stdenv.mkDerivation (finalAttrs: { ./efi-app-path.patch ]; + postPatch = '' + patchShebangs \ + contrib/generate-version-script.py \ + contrib/generate-man.py \ + po/test-deps + + # in nixos test tries to chmod 0777 $out/share/installed-tests/fwupd/tests/redfish.conf + sed -i "s/get_option('tests')/false/" plugins/redfish/meson.build + ''; + strictDeps = true; depsBuildBuild = [ @@ -173,16 +206,16 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ ensureNewerSourcesForZipFilesHook # required for firmware zipping + gettext + gi-docgen + gobject-introspection meson ninja pkg-config - gettext - shared-mime-info protobufc # for protoc - wrapGAppsNoGuiHook + shared-mime-info vala - gobject-introspection - gi-docgen + wrapGAppsNoGuiHook # jcat-tool at buildtime requires a home directory writableTmpDirAsHomeHook @@ -193,29 +226,29 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ - gnutls - polkit - libxmlb - gusb - sqlite - libarchive - libdrm + bash-completion curl elfutils + fwupd-efi + gnutls + gusb + libarchive + libcbor + libdrm libgudev libjcat - libuuid - bash-completion - pango - tpm2-tss - fwupd-efi - protobufc - modemmanager libmbim - libcbor libqmi - xz # for liblzma + libuuid + libxmlb + modemmanager + pango + polkit + protobufc + sqlite + tpm2-tss valgrind + xz # for liblzma ] ++ lib.optionals haveFlashrom [ flashrom @@ -279,18 +312,6 @@ stdenv.mkDerivation (finalAttrs: { PKG_CONFIG_POLKIT_GOBJECT_1_ACTIONDIR = "/run/current-system/sw/share/polkit-1/actions"; }; - # Phase hooks - - postPatch = '' - patchShebangs \ - contrib/generate-version-script.py \ - contrib/generate-man.py \ - po/test-deps - - # in nixos test tries to chmod 0777 $out/share/installed-tests/fwupd/tests/redfish.conf - sed -i "s/get_option('tests')/false/" plugins/redfish/meson.build - ''; - preCheck = '' addToSearchPath XDG_DATA_DIRS "${shared-mime-info}/share" @@ -307,8 +328,8 @@ stdenv.mkDerivation (finalAttrs: { preFixup = let binPath = [ - efibootmgr bubblewrap + efibootmgr tpm2-tools ]; in From 97db50d5b81b9e427b6e1ac4cfbee1b39a827268 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Sat, 15 Feb 2025 20:15:58 +0100 Subject: [PATCH 4/6] fwupd: add missing check input --- pkgs/by-name/fw/fwupd/package.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/by-name/fw/fwupd/package.nix b/pkgs/by-name/fw/fwupd/package.nix index e32f777a56fb..a26947ebd561 100644 --- a/pkgs/by-name/fw/fwupd/package.nix +++ b/pkgs/by-name/fw/fwupd/package.nix @@ -312,6 +312,10 @@ stdenv.mkDerivation (finalAttrs: { PKG_CONFIG_POLKIT_GOBJECT_1_ACTIONDIR = "/run/current-system/sw/share/polkit-1/actions"; }; + nativeCheckInputs = [ + polkit + ]; + preCheck = '' addToSearchPath XDG_DATA_DIRS "${shared-mime-info}/share" From 6cf8d7a4e6e69791426c9361c1e172442082eeb7 Mon Sep 17 00:00:00 2001 From: r-vdp Date: Sat, 15 Feb 2025 20:31:44 +0100 Subject: [PATCH 5/6] fwupd: use the meson functions from lib to create the flags --- pkgs/by-name/fw/fwupd/package.nix | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pkgs/by-name/fw/fwupd/package.nix b/pkgs/by-name/fw/fwupd/package.nix index a26947ebd561..0b22d8a99aaa 100644 --- a/pkgs/by-name/fw/fwupd/package.nix +++ b/pkgs/by-name/fw/fwupd/package.nix @@ -256,39 +256,39 @@ stdenv.mkDerivation (finalAttrs: { mesonFlags = [ - "-Ddocs=enabled" + (lib.mesonEnable "docs" true) # We are building the official releases. - "-Dsupported_build=enabled" - "-Dlaunchd=disabled" - "-Dsystemd_root_prefix=${placeholder "out"}" - "-Dinstalled_test_prefix=${placeholder "installedTests"}" + (lib.mesonEnable "supported_build" true) + (lib.mesonEnable "launchd" false) + (lib.mesonOption "systemd_root_prefix" "${placeholder "out"}") + (lib.mesonOption "installed_test_prefix" "${placeholder "installedTests"}") "--localstatedir=/var" "--sysconfdir=/etc" - "-Dsysconfdir_install=${placeholder "out"}/etc" - "-Defi_os_dir=nixos" - "-Dplugin_modem_manager=enabled" - "-Dvendor_metadata=true" - "-Dplugin_uefi_capsule_splash=false" + (lib.mesonOption "sysconfdir_install" "${placeholder "out"}/etc") + (lib.mesonOption "efi_os_dir" "nixos") + (lib.mesonEnable "plugin_modem_manager" true) + (lib.mesonBool "vendor_metadata" true) + (lib.mesonBool "plugin_uefi_capsule_splash" false) # TODO: what should this be? - "-Dvendor_ids_dir=${hwdata}/share/hwdata" - "-Dumockdev_tests=disabled" + (lib.mesonOption "vendor_ids_dir" "${hwdata}/share/hwdata") + (lib.mesonEnable "umockdev_tests" false) # We do not want to place the daemon into lib (cyclic reference) "--libexecdir=${placeholder "out"}/libexec" ] ++ lib.optionals (!enablePassim) [ - "-Dpassim=disabled" + (lib.mesonEnable "passim" false) ] ++ lib.optionals (!haveDell) [ - "-Dplugin_synaptics_mst=disabled" + (lib.mesonEnable "plugin_synaptics_mst" false) ] ++ lib.optionals (!haveRedfish) [ - "-Dplugin_redfish=disabled" + (lib.mesonEnable "plugin_redfish" false) ] ++ lib.optionals (!haveFlashrom) [ - "-Dplugin_flashrom=disabled" + (lib.mesonEnable "plugin_flashrom" false) ] ++ lib.optionals (!haveMSR) [ - "-Dplugin_msr=disabled" + (lib.mesonEnable "plugin_msr" false) ]; # TODO: wrapGAppsHook3 wraps efi capsule even though it is not ELF From 38a08f9a49adc342fb52290e0d49efe3ccdf706b Mon Sep 17 00:00:00 2001 From: Ramses Date: Sun, 16 Feb 2025 14:16:29 +0100 Subject: [PATCH 6/6] fwupd: use substitute instead of sed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: GaƩtan Lepage <33058747+GaetanLepage@users.noreply.github.com> --- pkgs/by-name/fw/fwupd/package.nix | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pkgs/by-name/fw/fwupd/package.nix b/pkgs/by-name/fw/fwupd/package.nix index 0b22d8a99aaa..e62ec1da3f04 100644 --- a/pkgs/by-name/fw/fwupd/package.nix +++ b/pkgs/by-name/fw/fwupd/package.nix @@ -182,15 +182,18 @@ stdenv.mkDerivation (finalAttrs: { ./efi-app-path.patch ]; - postPatch = '' - patchShebangs \ - contrib/generate-version-script.py \ - contrib/generate-man.py \ - po/test-deps - + postPatch = + '' + patchShebangs \ + contrib/generate-version-script.py \ + contrib/generate-man.py \ + po/test-deps + '' # in nixos test tries to chmod 0777 $out/share/installed-tests/fwupd/tests/redfish.conf - sed -i "s/get_option('tests')/false/" plugins/redfish/meson.build - ''; + + '' + substituteInPlace plugins/redfish/meson.build \ + --replace-fail "get_option('tests')" "false" + ''; strictDeps = true;