2024-06-24 18:47:55 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
fetchurl,
|
|
|
|
runCommand,
|
|
|
|
appstream,
|
|
|
|
autoreconfHook,
|
|
|
|
bison,
|
|
|
|
bubblewrap,
|
|
|
|
bzip2,
|
|
|
|
coreutils,
|
|
|
|
curl,
|
|
|
|
dbus,
|
|
|
|
dconf,
|
|
|
|
desktop-file-utils,
|
|
|
|
docbook_xml_dtd_45,
|
|
|
|
docbook-xsl-nons,
|
|
|
|
fuse3,
|
|
|
|
gettext,
|
|
|
|
glib,
|
|
|
|
glib-networking,
|
|
|
|
gobject-introspection,
|
|
|
|
gpgme,
|
|
|
|
gsettings-desktop-schemas,
|
|
|
|
gtk3,
|
|
|
|
gtk-doc,
|
|
|
|
hicolor-icon-theme,
|
|
|
|
intltool,
|
|
|
|
json-glib,
|
|
|
|
libarchive,
|
|
|
|
libcap,
|
|
|
|
librsvg,
|
|
|
|
libseccomp,
|
|
|
|
libxml2,
|
|
|
|
libxslt,
|
|
|
|
nix-update-script,
|
|
|
|
nixosTests,
|
|
|
|
nixos-icons,
|
|
|
|
ostree,
|
|
|
|
p11-kit,
|
|
|
|
pkg-config,
|
|
|
|
polkit,
|
|
|
|
python3,
|
|
|
|
shared-mime-info,
|
|
|
|
socat,
|
|
|
|
substituteAll,
|
|
|
|
systemd,
|
|
|
|
testers,
|
|
|
|
valgrind,
|
|
|
|
which,
|
|
|
|
wrapGAppsNoGuiHook,
|
|
|
|
xdg-dbus-proxy,
|
|
|
|
xmlto,
|
|
|
|
xorg,
|
|
|
|
xz,
|
|
|
|
zstd,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "flatpak";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "1.14.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# TODO: split out lib once we figure out what to do with triggerdir
|
2024-06-24 18:47:55 +00:00
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"dev"
|
|
|
|
"man"
|
|
|
|
"doc"
|
|
|
|
"devdoc"
|
|
|
|
"installedTests"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2022-10-21 18:38:19 +00:00
|
|
|
url = "https://github.com/flatpak/flatpak/releases/download/${finalAttrs.version}/flatpak-${finalAttrs.version}.tar.xz";
|
2024-06-24 18:47:55 +00:00
|
|
|
hash = "sha256-U482ssb4xw7v0S0TrVsa2DCCAQaovTqfa45NnegeSUY=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# Hardcode paths used by tests and change test runtime generation to use files from Nix store.
|
|
|
|
# https://github.com/flatpak/flatpak/issues/1460
|
|
|
|
(substituteAll {
|
|
|
|
src = ./fix-test-paths.patch;
|
2024-06-24 18:47:55 +00:00
|
|
|
inherit
|
|
|
|
coreutils
|
|
|
|
gettext
|
|
|
|
socat
|
|
|
|
gtk3
|
|
|
|
;
|
2020-04-24 23:36:52 +00:00
|
|
|
smi = shared-mime-info;
|
|
|
|
dfu = desktop-file-utils;
|
|
|
|
hicolorIconTheme = hicolor-icon-theme;
|
|
|
|
})
|
|
|
|
|
|
|
|
# Hardcode paths used by Flatpak itself.
|
|
|
|
(substituteAll {
|
|
|
|
src = ./fix-paths.patch;
|
2022-02-10 20:34:41 +00:00
|
|
|
p11kit = "${p11-kit.bin}/bin/p11-kit";
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
# Allow gtk-doc to find schemas using XML_CATALOG_FILES environment variable.
|
|
|
|
# Patch taken from gtk-doc expression.
|
|
|
|
./respect-xml-catalog-files-var.patch
|
|
|
|
|
|
|
|
# Nix environment hacks should not leak into the apps.
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/53441
|
|
|
|
./unset-env-vars.patch
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
# Use flatpak from PATH to avoid references to `/nix/store` in `/desktop` files.
|
|
|
|
# Applications containing `DBusActivatable` entries should be able to find the flatpak binary.
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/138956
|
|
|
|
./binary-path.patch
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
# The icon validator needs to access the gdk-pixbuf loaders in the Nix store
|
|
|
|
# and cannot bind FHS paths since those are not available on NixOS.
|
|
|
|
finalAttrs.passthru.icon-validator-patch
|
2024-04-21 15:54:59 +00:00
|
|
|
|
|
|
|
# Try mounting fonts and icons from NixOS locations if FHS locations don't exist.
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/119433
|
|
|
|
./fix-fonts-icons.patch
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-02-05 17:12:51 +00:00
|
|
|
autoreconfHook
|
2020-04-24 23:36:52 +00:00
|
|
|
libxml2
|
2021-02-05 17:12:51 +00:00
|
|
|
docbook_xml_dtd_45
|
2020-08-20 17:08:02 +00:00
|
|
|
docbook-xsl-nons
|
2020-04-24 23:36:52 +00:00
|
|
|
which
|
|
|
|
gobject-introspection
|
|
|
|
gtk-doc
|
|
|
|
intltool
|
|
|
|
libxslt
|
2020-08-20 17:08:02 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
xmlto
|
2021-04-05 15:23:46 +00:00
|
|
|
bison
|
2021-02-05 17:12:51 +00:00
|
|
|
wrapGAppsNoGuiHook
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2022-10-21 18:38:19 +00:00
|
|
|
appstream
|
2020-04-24 23:36:52 +00:00
|
|
|
bubblewrap
|
|
|
|
bzip2
|
2022-10-21 18:38:19 +00:00
|
|
|
curl
|
2020-04-24 23:36:52 +00:00
|
|
|
dbus
|
|
|
|
dconf
|
|
|
|
gpgme
|
|
|
|
json-glib
|
|
|
|
libarchive
|
|
|
|
libcap
|
|
|
|
libseccomp
|
2021-04-05 15:23:46 +00:00
|
|
|
xz
|
2021-02-05 17:12:51 +00:00
|
|
|
zstd
|
2020-04-24 23:36:52 +00:00
|
|
|
polkit
|
|
|
|
python3
|
|
|
|
systemd
|
|
|
|
xorg.libXau
|
2022-10-21 18:38:19 +00:00
|
|
|
fuse3
|
2020-04-24 23:36:52 +00:00
|
|
|
gsettings-desktop-schemas
|
|
|
|
glib-networking
|
|
|
|
librsvg # for flatpak-validate-icon
|
|
|
|
];
|
|
|
|
|
|
|
|
# Required by flatpak.pc
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
glib
|
|
|
|
ostree
|
|
|
|
];
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
nativeCheckInputs = [ valgrind ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# TODO: some issues with temporary files
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
NIX_LDFLAGS = "-lpthread";
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
configureFlags = [
|
2022-10-21 18:38:19 +00:00
|
|
|
"--with-curl"
|
2024-06-24 18:47:55 +00:00
|
|
|
"--with-system-bubblewrap=${lib.getExe bubblewrap}"
|
|
|
|
"--with-system-dbus-proxy=${lib.getExe xdg-dbus-proxy}"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-dbus-config-dir=${placeholder "out"}/share/dbus-1/system.d"
|
2024-06-24 18:47:55 +00:00
|
|
|
"--with-profile-dir=${placeholder "out"}/etc/profile.d"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--localstatedir=/var"
|
2024-06-24 18:47:55 +00:00
|
|
|
"--sysconfdir=/etc"
|
2020-08-20 17:08:02 +00:00
|
|
|
"--enable-gtk-doc"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--enable-installed-tests"
|
|
|
|
];
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"installed_testdir=${placeholder "installedTests"}/libexec/installed-tests/flatpak"
|
|
|
|
"installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/flatpak"
|
|
|
|
];
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
postPatch =
|
|
|
|
let
|
|
|
|
vsc-py = python3.withPackages (pp: [ pp.pyparsing ]);
|
|
|
|
in
|
|
|
|
''
|
|
|
|
patchShebangs buildutil
|
|
|
|
patchShebangs tests
|
|
|
|
PATH=${lib.makeBinPath [ vsc-py ]}:$PATH patchShebangs --build subprojects/variant-schema-compiler/variant-schema-compiler
|
|
|
|
'';
|
2021-10-17 09:34:42 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
passthru = {
|
2022-10-21 18:38:19 +00:00
|
|
|
icon-validator-patch = substituteAll {
|
|
|
|
src = ./fix-icon-validation.patch;
|
|
|
|
inherit (builtins) storeDir;
|
|
|
|
};
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
updateScript = nix-update-script { };
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
tests = {
|
|
|
|
installedTests = nixosTests.installed-tests.flatpak;
|
2022-10-21 18:38:19 +00:00
|
|
|
|
|
|
|
validate-icon = runCommand "test-icon-validation" { } ''
|
2024-06-24 18:47:55 +00:00
|
|
|
${finalAttrs.finalPackage}/libexec/flatpak-validate-icon \
|
|
|
|
--sandbox 512 512 \
|
|
|
|
"${nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake-white.svg" > "$out"
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
grep format=svg "$out"
|
|
|
|
'';
|
2024-06-24 18:47:55 +00:00
|
|
|
|
|
|
|
version = testers.testVersion { package = finalAttrs.finalPackage; };
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-06-24 18:47:55 +00:00
|
|
|
meta = {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Linux application sandboxing and distribution framework";
|
|
|
|
homepage = "https://flatpak.org/";
|
2024-06-24 18:47:55 +00:00
|
|
|
changelog = "https://github.com/flatpak/flatpak/releases/tag/${finalAttrs.version}";
|
|
|
|
license = lib.licenses.lgpl21Plus;
|
|
|
|
maintainers = with lib.maintainers; [ getchoo ];
|
|
|
|
platforms = lib.platforms.linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2022-10-21 18:38:19 +00:00
|
|
|
})
|