chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / fl / flatpak / package.nix
blob231b682cc2cbbf8564488895b28b60b387d7fc43
2   lib,
3   stdenv,
4   fetchurl,
5   fetchpatch,
6   runCommand,
7   appstream,
8   autoreconfHook,
9   bison,
10   bubblewrap,
11   buildPackages,
12   bzip2,
13   coreutils,
14   curl,
15   dbus,
16   dconf,
17   desktop-file-utils,
18   docbook_xml_dtd_45,
19   docbook-xsl-nons,
20   fuse3,
21   gettext,
22   glib,
23   glib-networking,
24   gobject-introspection,
25   gpgme,
26   gsettings-desktop-schemas,
27   gtk3,
28   gtk-doc,
29   hicolor-icon-theme,
30   intltool,
31   json-glib,
32   libarchive,
33   libcap,
34   librsvg,
35   libseccomp,
36   libxml2,
37   libxslt,
38   nix-update-script,
39   nixosTests,
40   nixos-icons,
41   ostree,
42   p11-kit,
43   pkg-config,
44   polkit,
45   pkgsCross,
46   python3,
47   shared-mime-info,
48   socat,
49   substituteAll,
50   systemd,
51   testers,
52   valgrind,
53   which,
54   wrapGAppsNoGuiHook,
55   xdg-dbus-proxy,
56   xmlto,
57   xorg,
58   xz,
59   zstd,
60   withGtkDoc ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
63 stdenv.mkDerivation (finalAttrs: {
64   pname = "flatpak";
65   version = "1.14.10";
67   # TODO: split out lib once we figure out what to do with triggerdir
68   outputs = [
69     "out"
70     "dev"
71     "man"
72     "doc"
73     "devdoc"
74     "installedTests"
75   ];
77   src = fetchurl {
78     url = "https://github.com/flatpak/flatpak/releases/download/${finalAttrs.version}/flatpak-${finalAttrs.version}.tar.xz";
79     hash = "sha256-a73HkIEnNQrYWkpH1wKSyi9MRul3sysf0jHCpxnYIc0=";
80   };
82   patches = [
83     # Hardcode paths used by tests and change test runtime generation to use files from Nix store.
84     # https://github.com/flatpak/flatpak/issues/1460
85     (substituteAll {
86       src = ./fix-test-paths.patch;
87       inherit
88         coreutils
89         gettext
90         socat
91         gtk3
92         ;
93       smi = shared-mime-info;
94       dfu = desktop-file-utils;
95       hicolorIconTheme = hicolor-icon-theme;
96     })
98     # Hardcode paths used by Flatpak itself.
99     (substituteAll {
100       src = ./fix-paths.patch;
101       p11kit = "${p11-kit.bin}/bin/p11-kit";
102     })
104     # Allow gtk-doc to find schemas using XML_CATALOG_FILES environment variable.
105     # Patch taken from gtk-doc expression.
106     ./respect-xml-catalog-files-var.patch
108     # Nix environment hacks should not leak into the apps.
109     # https://github.com/NixOS/nixpkgs/issues/53441
110     ./unset-env-vars.patch
112     # Use flatpak from PATH to avoid references to `/nix/store` in `/desktop` files.
113     # Applications containing `DBusActivatable` entries should be able to find the flatpak binary.
114     # https://github.com/NixOS/nixpkgs/issues/138956
115     ./binary-path.patch
117     # The icon validator needs to access the gdk-pixbuf loaders in the Nix store
118     # and cannot bind FHS paths since those are not available on NixOS.
119     finalAttrs.passthru.icon-validator-patch
121     # Try mounting fonts and icons from NixOS locations if FHS locations don't exist.
122     # https://github.com/NixOS/nixpkgs/issues/119433
123     ./fix-fonts-icons.patch
125     # TODO: Remove when updating to 1.16
126     # Ensure flatpak uses the system's zoneinfo from $TZDIR
127     # https://github.com/NixOS/nixpkgs/issues/238386
128     (fetchpatch {
129       url = "https://github.com/flatpak/flatpak/pull/5850/commits/a8a35bf4d9fc3d76e1a5049a6a591faec04a42fd.patch";
130       hash = "sha256-JqkPbnzgZNZq/mplZqohhHFdjRrvYFjE4C02pI3feBo=";
131     })
132     (fetchpatch {
133       url = "https://github.com/flatpak/flatpak/pull/5850/commits/5ea13b09612215559081c27b60df4fb720cb08d5.patch";
134       hash = "sha256-BWbyQ2en3RtN4Ec5n62CULAhvywlQLhcl3Fmd4fsR1s=";
135     })
136     (fetchpatch {
137       url = "https://github.com/flatpak/flatpak/pull/5850/commits/7c8a81f08908019bbf69358de199748a9bcb29e3.patch";
138       hash = "sha256-RiG2jPmG+Igskxv8oQquOUYsG4srgdMXWe34ojMXslo=";
139     })
140   ];
142   nativeBuildInputs = [
143     autoreconfHook
144     libxml2
145     docbook_xml_dtd_45
146     docbook-xsl-nons
147     which
148     gobject-introspection
149     gtk-doc
150     intltool
151     libxslt
152     pkg-config
153     xmlto
154     bison
155     wrapGAppsNoGuiHook
156   ];
158   buildInputs = [
159     appstream
160     bubblewrap
161     bzip2
162     curl
163     dbus
164     dconf
165     gpgme
166     json-glib
167     libarchive
168     libcap
169     libseccomp
170     libxml2
171     xz
172     zstd
173     polkit
174     python3
175     systemd
176     xorg.libXau
177     fuse3
178     gsettings-desktop-schemas
179     glib-networking
180     librsvg # for flatpak-validate-icon
181   ] ++ lib.optionals withGtkDoc [ gtk-doc ];
183   # Required by flatpak.pc
184   propagatedBuildInputs = [
185     glib
186     ostree
187   ];
189   nativeCheckInputs = [ valgrind ];
191   # TODO: some issues with temporary files
192   doCheck = false;
193   strictDeps = true;
195   NIX_LDFLAGS = "-lpthread";
197   enableParallelBuilding = true;
199   configureFlags = [
200     "--with-curl"
201     "--with-system-bubblewrap=${lib.getExe bubblewrap}"
202     "--with-system-dbus-proxy=${lib.getExe xdg-dbus-proxy}"
203     "--with-dbus-config-dir=${placeholder "out"}/share/dbus-1/system.d"
204     "--with-profile-dir=${placeholder "out"}/etc/profile.d"
205     "--localstatedir=/var"
206     "--sysconfdir=/etc"
207     "--enable-gtk-doc=${if withGtkDoc then "yes" else "no"}"
208     "--enable-installed-tests"
209     "--enable-selinux-module=no"
210   ];
212   makeFlags = [
213     "installed_testdir=${placeholder "installedTests"}/libexec/installed-tests/flatpak"
214     "installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/flatpak"
215   ];
217   postPatch =
218     let
219       vsc-py = python3.pythonOnBuildForHost.withPackages (pp: [ pp.pyparsing ]);
220     in
221     ''
222       patchShebangs buildutil
223       patchShebangs tests
224       PATH=${lib.makeBinPath [ vsc-py ]}:$PATH patchShebangs --build subprojects/variant-schema-compiler/variant-schema-compiler
226       substituteInPlace configure.ac \
227         --replace-fail '$BWRAP --' ${
228           lib.escapeShellArg (stdenv.hostPlatform.emulator buildPackages + " $BWRAP --")
229         } \
230         --replace-fail '$DBUS_PROXY --' ${
231           lib.escapeShellArg (stdenv.hostPlatform.emulator buildPackages + " $DBUS_PROXY --")
232         }
233     '';
235   passthru = {
236     icon-validator-patch = substituteAll {
237       src = ./fix-icon-validation.patch;
238       inherit (builtins) storeDir;
239     };
241     updateScript = nix-update-script { };
243     tests = {
244       cross = pkgsCross.aarch64-multiplatform.flatpak;
246       installedTests = nixosTests.installed-tests.flatpak;
248       validate-icon = runCommand "test-icon-validation" { } ''
249         ${finalAttrs.finalPackage}/libexec/flatpak-validate-icon \
250           --sandbox 512 512 \
251           "${nixos-icons}/share/icons/hicolor/512x512/apps/nix-snowflake.png" > "$out"
253         grep format=png "$out"
254       '';
256       version = testers.testVersion { package = finalAttrs.finalPackage; };
257     };
258   };
260   meta = {
261     description = "Linux application sandboxing and distribution framework";
262     homepage = "https://flatpak.org/";
263     changelog = "https://github.com/flatpak/flatpak/releases/tag/${finalAttrs.version}";
264     license = lib.licenses.lgpl21Plus;
265     maintainers = with lib.maintainers; [ getchoo ];
266     platforms = lib.platforms.linux;
267   };