xdg-desktop-portal: fix icon validation

Validation requires bubblewrap, but the current build system does not enforce it being present.

Additionally, the validation itself needs to have thumbnailer Nix store paths available in sandbox. Let’s add a patch from Flatpak and introduce a test verifying it still works.

This was probably broken since c3b07a052f
This commit is contained in:
Jan Tojnar 2022-09-23 03:26:17 +02:00
parent a69e7fd7f4
commit 9121a522fd

View file

@ -3,9 +3,9 @@
, autoreconfHook
, dbus
, fetchFromGitHub
, fetchpatch
, flatpak
, fuse3
, bubblewrap
, systemdMinimal
, geoclue2
, glib
@ -20,12 +20,12 @@
, python3
, pkg-config
, stdenv
, substituteAll
, runCommand
, wrapGAppsHook
, enableGeoLocation ? true
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "xdg-desktop-portal";
version = "1.15.0";
@ -33,11 +33,21 @@ stdenv.mkDerivation rec {
src = fetchFromGitHub {
owner = "flatpak";
repo = pname;
rev = version;
repo = "xdg-desktop-portal";
rev = finalAttrs.version;
sha256 = "sha256-Kw3zJeGwPfw1fDo8HsgYmrpgCk/PUvWZPRloKJNAJVc=";
};
patches = [
# The icon validator copied from Flatpak needs to access the gdk-pixbuf loaders
# in the Nix store and cannot bind FHS paths since those are not available on NixOS.
(runCommand "icon-validator.patch" { } ''
# Flatpak uses a different path
substitute "${flatpak.icon-validator-patch}" "$out" \
--replace "/icon-validator/validate-icon.c" "/src/validate-icon.c"
'')
];
nativeBuildInputs = [
autoreconfHook
libxml2
@ -50,6 +60,7 @@ stdenv.mkDerivation rec {
dbus
flatpak
fuse3
bubblewrap
systemdMinimal # libsystemd
glib
gsettings-desktop-schemas
@ -83,6 +94,11 @@ stdenv.mkDerivation rec {
passthru = {
tests = {
installedTests = nixosTests.installed-tests.xdg-desktop-portal;
validate-icon = runCommand "test-icon-validation" { } ''
${finalAttrs.finalPackage}/libexec/xdg-desktop-portal-validate-icon --sandbox 512 512 ${../../../applications/audio/zynaddsubfx/ZynLogo.svg} > "$out"
grep format=svg "$out"
'';
};
};
@ -92,4 +108,4 @@ stdenv.mkDerivation rec {
maintainers = with maintainers; [ jtojnar ];
platforms = platforms.linux;
};
}
})