diff --git a/nixos/release.nix b/nixos/release.nix index 4cae07dd99ac..f3d6eee1747f 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -258,6 +258,7 @@ in rec { tests.firefox = callTest tests/firefox.nix {}; tests.firewall = callTest tests/firewall.nix {}; tests.fleet = callTestOnTheseSystems ["x86_64-linux"] tests/fleet.nix {}; + tests.fwupd = callTest tests/fwupd.nix {}; #tests.gitlab = callTest tests/gitlab.nix {}; tests.gitolite = callTest tests/gitolite.nix {}; tests.gocd-agent = callTest tests/gocd-agent.nix {}; diff --git a/nixos/tests/fwupd.nix b/nixos/tests/fwupd.nix new file mode 100644 index 000000000000..bf4ef25130b3 --- /dev/null +++ b/nixos/tests/fwupd.nix @@ -0,0 +1,19 @@ +# run installed tests +import ./make-test.nix ({ pkgs, ... }: { + name = "fwupd"; + + meta = { + maintainers = pkgs.fwupd.meta.maintainers; + }; + + machine = { config, pkgs, ... }: { + services.fwupd.enable = true; + environment.systemPackages = with pkgs; [ gnome-desktop-testing ]; + environment.variables.XDG_DATA_DIRS = [ "${pkgs.fwupd.installedTests}/share" ]; + virtualisation.memorySize = 768; + }; + + testScript = '' + $machine->succeed("gnome-desktop-testing-runner"); + ''; +}) diff --git a/pkgs/os-specific/linux/firmware/fwupd/default.nix b/pkgs/os-specific/linux/firmware/fwupd/default.nix index 8e5342e5e11d..24cca3596c40 100644 --- a/pkgs/os-specific/linux/firmware/fwupd/default.nix +++ b/pkgs/os-specific/linux/firmware/fwupd/default.nix @@ -1,12 +1,14 @@ { stdenv, fetchurl, fetchpatch, gtk_doc, pkgconfig, gobjectIntrospection, intltool , libgudev, polkit, appstream-glib, gusb, sqlite, libarchive, glib_networking , libsoup, docbook2x, gpgme, libxslt, elfutils, libsmbios, efivar, glibcLocales -, fwupdate, libyaml, valgrind, meson, libuuid, pygobject3, colord -, pillow, ninja, gcab, gnutls, python3Packages, wrapGAppsHook, json_glib +, fwupdate, libyaml, valgrind, meson, libuuid, colord +, ninja, gcab, gnutls, python3, wrapGAppsHook, json_glib , shared_mime_info, umockdev }: let version = "1.0.4"; + python = python3.withPackages (p: with p; [ pygobject3 pycairo pillow ]); + installedTestsPython = python3.withPackages (p: with p; [ pygobject3 requests ]); in stdenv.mkDerivation { name = "fwupd-${version}"; src = fetchurl { @@ -18,11 +20,11 @@ in stdenv.mkDerivation { nativeBuildInputs = [ meson ninja gtk_doc pkgconfig gobjectIntrospection intltool glibcLocales shared_mime_info - valgrind gcab docbook2x libxslt pygobject3 python3Packages.pycairo wrapGAppsHook + valgrind gcab docbook2x libxslt python wrapGAppsHook ]; buildInputs = [ polkit appstream-glib gusb sqlite libarchive libsoup elfutils libsmbios fwupdate libyaml - libgudev colord gpgme libuuid pillow gnutls glib_networking efivar json_glib umockdev + libgudev colord gpgme libuuid gnutls glib_networking efivar json_glib umockdev ]; LC_ALL = "en_US.UTF-8"; # For po/make-images @@ -34,8 +36,18 @@ in stdenv.mkDerivation { url = https://github.com/hughsie/fwupd/commit/bd6082574989e4f48b66c7270bb408d439b77a06.patch; sha256 = "17pixyizkmn6wlsjmr1wwya17ivn770hdv9mp769vifxinya8w9y"; }) + # https://github.com/hughsie/fwupd/issues/405 + (fetchpatch { + url = https://github.com/hughsie/fwupd/pull/407.patch; + sha256 = "1dxhqps12x7bz0s974xk5hfpk4nwn1gs29vl0dfi9j54wy18f688"; + }) ]; + postPatch = '' + # needs a different set of modules than po/make-images + escapedInterpreterLine=$(echo "${installedTestsPython}/bin/python3" | sed 's|\\|\\\\|g') + sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" data/installed-tests/hardware.py + patchShebangs . substituteInPlace data/installed-tests/fwupdmgr.test.in --subst-var-by installedtestsdir "$installedTests/share/installed-tests/fwupd" ''; @@ -48,6 +60,7 @@ in stdenv.mkDerivation { mesonFlags = [ "-Dman=false" + "-Dplugin_dummy=true" "-Dgtkdoc=false" "-Dbootdir=/boot" "-Dudevdir=lib/udev" @@ -57,6 +70,8 @@ in stdenv.mkDerivation { postInstall = '' moveToOutput share/installed-tests "$installedTests" + wrapProgram $installedTests/share/installed-tests/fwupd/hardware.py \ + --prefix GI_TYPELIB_PATH : "$out/lib/girepository-1.0:${libsoup}/lib/girepository-1.0" ''; enableParallelBuilding = true; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4d322bc7672e..ad4c3358a26e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12728,7 +12728,7 @@ with pkgs; fscrypt-experimental = callPackage ../os-specific/linux/fscrypt { }; fscryptctl-experimental = callPackage ../os-specific/linux/fscryptctl { }; - fwupd = callPackage ../os-specific/linux/firmware/fwupd { inherit (gnome2) gtk_doc; inherit (python3Packages) pygobject3 pillow; }; + fwupd = callPackage ../os-specific/linux/firmware/fwupd { inherit (gnome2) gtk_doc; }; fwupdate = callPackage ../os-specific/linux/firmware/fwupdate { };