22 gobject-introspection,
24 gsettings-desktop-schemas,
59 stdenv.mkDerivation (finalAttrs: {
63 # TODO: split out lib once we figure out what to do with triggerdir
74 url = "https://github.com/flatpak/flatpak/releases/download/${finalAttrs.version}/flatpak-${finalAttrs.version}.tar.xz";
75 hash = "sha256-EBa3Mn96+HiW+VRl9+WBN1DTtwSaN0ChpN3LX6jFNI4=";
79 # Hardcode paths used by tests and change test runtime generation to use files from Nix store.
80 # https://github.com/flatpak/flatpak/issues/1460
82 src = ./fix-test-paths.patch;
89 smi = shared-mime-info;
90 dfu = desktop-file-utils;
91 hicolorIconTheme = hicolor-icon-theme;
94 # Hardcode paths used by Flatpak itself.
96 src = ./fix-paths.patch;
97 p11kit = "${p11-kit.bin}/bin/p11-kit";
100 # Allow gtk-doc to find schemas using XML_CATALOG_FILES environment variable.
101 # Patch taken from gtk-doc expression.
102 ./respect-xml-catalog-files-var.patch
104 # Nix environment hacks should not leak into the apps.
105 # https://github.com/NixOS/nixpkgs/issues/53441
106 ./unset-env-vars.patch
108 # Use flatpak from PATH to avoid references to `/nix/store` in `/desktop` files.
109 # Applications containing `DBusActivatable` entries should be able to find the flatpak binary.
110 # https://github.com/NixOS/nixpkgs/issues/138956
113 # The icon validator needs to access the gdk-pixbuf loaders in the Nix store
114 # and cannot bind FHS paths since those are not available on NixOS.
115 finalAttrs.passthru.icon-validator-patch
117 # Try mounting fonts and icons from NixOS locations if FHS locations don't exist.
118 # https://github.com/NixOS/nixpkgs/issues/119433
119 ./fix-fonts-icons.patch
122 nativeBuildInputs = [
128 gobject-introspection
157 gsettings-desktop-schemas
159 librsvg # for flatpak-validate-icon
162 # Required by flatpak.pc
163 propagatedBuildInputs = [
168 nativeCheckInputs = [ valgrind ];
170 # TODO: some issues with temporary files
173 NIX_LDFLAGS = "-lpthread";
175 enableParallelBuilding = true;
179 "--with-system-bubblewrap=${lib.getExe bubblewrap}"
180 "--with-system-dbus-proxy=${lib.getExe xdg-dbus-proxy}"
181 "--with-dbus-config-dir=${placeholder "out"}/share/dbus-1/system.d"
182 "--with-profile-dir=${placeholder "out"}/etc/profile.d"
183 "--localstatedir=/var"
186 "--enable-installed-tests"
190 "installed_testdir=${placeholder "installedTests"}/libexec/installed-tests/flatpak"
191 "installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/flatpak"
196 vsc-py = python3.withPackages (pp: [ pp.pyparsing ]);
199 patchShebangs buildutil
201 PATH=${lib.makeBinPath [ vsc-py ]}:$PATH patchShebangs --build subprojects/variant-schema-compiler/variant-schema-compiler
205 icon-validator-patch = substituteAll {
206 src = ./fix-icon-validation.patch;
207 inherit (builtins) storeDir;
210 updateScript = nix-update-script { };
213 installedTests = nixosTests.installed-tests.flatpak;
215 validate-icon = runCommand "test-icon-validation" { } ''
216 ${finalAttrs.finalPackage}/libexec/flatpak-validate-icon \
218 "${nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake-white.svg" > "$out"
220 grep format=svg "$out"
223 version = testers.testVersion { package = finalAttrs.finalPackage; };
228 description = "Linux application sandboxing and distribution framework";
229 homepage = "https://flatpak.org/";
230 changelog = "https://github.com/flatpak/flatpak/releases/tag/${finalAttrs.version}";
231 license = lib.licenses.lgpl21Plus;
232 maintainers = with lib.maintainers; [ getchoo ];
233 platforms = lib.platforms.linux;