2021-01-21 18:00:13 +01:00
|
|
|
|
{ lib, stdenv
|
2020-02-07 22:55:16 +01:00
|
|
|
|
, fetchurl
|
2021-03-13 18:40:46 +01:00
|
|
|
|
, fetchpatch
|
2021-02-01 21:53:32 +01:00
|
|
|
|
, autoreconfHook
|
|
|
|
|
, docbook_xml_dtd_45
|
2020-07-24 09:04:16 +02:00
|
|
|
|
, docbook-xsl-nons
|
2020-02-07 22:55:16 +01:00
|
|
|
|
, which
|
|
|
|
|
, libxml2
|
|
|
|
|
, gobject-introspection
|
|
|
|
|
, gtk-doc
|
|
|
|
|
, intltool
|
|
|
|
|
, libxslt
|
2020-07-24 09:04:16 +02:00
|
|
|
|
, pkg-config
|
2020-02-07 22:55:16 +01:00
|
|
|
|
, xmlto
|
|
|
|
|
, appstream-glib
|
|
|
|
|
, substituteAll
|
2021-03-14 18:50:12 +01:00
|
|
|
|
, bison
|
2020-02-07 22:55:16 +01:00
|
|
|
|
, xdg-dbus-proxy
|
|
|
|
|
, p11-kit
|
|
|
|
|
, bubblewrap
|
|
|
|
|
, bzip2
|
|
|
|
|
, dbus
|
|
|
|
|
, glib
|
|
|
|
|
, gpgme
|
|
|
|
|
, json-glib
|
|
|
|
|
, libarchive
|
|
|
|
|
, libcap
|
|
|
|
|
, libseccomp
|
|
|
|
|
, coreutils
|
2020-02-08 06:28:43 +01:00
|
|
|
|
, socat
|
2020-02-07 22:55:16 +01:00
|
|
|
|
, gettext
|
|
|
|
|
, hicolor-icon-theme
|
2020-02-08 06:28:43 +01:00
|
|
|
|
, shared-mime-info
|
|
|
|
|
, desktop-file-utils
|
|
|
|
|
, gtk3
|
2020-02-07 22:55:16 +01:00
|
|
|
|
, fuse
|
|
|
|
|
, nixosTests
|
|
|
|
|
, libsoup
|
2021-03-14 19:12:53 +01:00
|
|
|
|
, xz
|
2020-07-24 09:04:16 +02:00
|
|
|
|
, zstd
|
2020-02-07 22:55:16 +01:00
|
|
|
|
, ostree
|
|
|
|
|
, polkit
|
|
|
|
|
, python3
|
|
|
|
|
, systemd
|
|
|
|
|
, xorg
|
|
|
|
|
, valgrind
|
|
|
|
|
, glib-networking
|
2021-02-01 21:53:32 +01:00
|
|
|
|
, wrapGAppsNoGuiHook
|
2020-02-07 22:55:16 +01:00
|
|
|
|
, dconf
|
|
|
|
|
, gsettings-desktop-schemas
|
|
|
|
|
, librsvg
|
|
|
|
|
}:
|
2017-10-02 15:40:26 +02:00
|
|
|
|
|
2018-11-16 18:00:58 +01:00
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
|
pname = "flatpak";
|
2021-03-11 15:29:53 +01:00
|
|
|
|
version = "1.10.2";
|
2017-10-02 15:40:26 +02:00
|
|
|
|
|
2018-09-06 11:38:09 +02:00
|
|
|
|
# TODO: split out lib once we figure out what to do with triggerdir
|
2020-07-24 09:04:16 +02:00
|
|
|
|
outputs = [ "out" "dev" "man" "doc" "devdoc" "installedTests" ];
|
2017-10-02 15:40:26 +02:00
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
2018-11-16 18:00:58 +01:00
|
|
|
|
url = "https://github.com/flatpak/flatpak/releases/download/${version}/${pname}-${version}.tar.xz";
|
2021-03-11 15:29:53 +01:00
|
|
|
|
sha256 = "sha256-2xUnOdBy+P8pnk6IjYljobRTjaexDguGUlvkOPLh3eQ=";
|
2017-10-02 15:40:26 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
patches = [
|
2020-02-07 22:55:16 +01:00
|
|
|
|
# Hardcode paths used by tests and change test runtime generation to use files from Nix store.
|
|
|
|
|
# https://github.com/flatpak/flatpak/issues/1460
|
2017-10-02 15:40:26 +02:00
|
|
|
|
(substituteAll {
|
|
|
|
|
src = ./fix-test-paths.patch;
|
2020-07-24 09:04:16 +02:00
|
|
|
|
inherit coreutils gettext socat gtk3;
|
2020-02-08 06:28:43 +01:00
|
|
|
|
smi = shared-mime-info;
|
|
|
|
|
dfu = desktop-file-utils;
|
2017-10-02 15:40:26 +02:00
|
|
|
|
hicolorIconTheme = hicolor-icon-theme;
|
|
|
|
|
})
|
2020-02-07 22:55:16 +01:00
|
|
|
|
|
|
|
|
|
# Hardcode paths used by Flatpak itself.
|
2018-09-06 11:38:09 +02:00
|
|
|
|
(substituteAll {
|
|
|
|
|
src = ./fix-paths.patch;
|
2020-02-18 17:48:24 +01:00
|
|
|
|
p11kit = "${p11-kit.dev}/bin/p11-kit";
|
2018-09-06 11:38:09 +02:00
|
|
|
|
})
|
2020-02-07 22:55:16 +01:00
|
|
|
|
|
|
|
|
|
# Adapt paths exposed to sandbox for NixOS.
|
2019-03-19 05:57:43 +01:00
|
|
|
|
(substituteAll {
|
|
|
|
|
src = ./bubblewrap-paths.patch;
|
|
|
|
|
inherit (builtins) storeDir;
|
|
|
|
|
})
|
2020-02-07 22:55:16 +01:00
|
|
|
|
|
|
|
|
|
# Allow gtk-doc to find schemas using XML_CATALOG_FILES environment variable.
|
|
|
|
|
# Patch taken from gtk-doc expression.
|
2017-10-02 15:40:26 +02:00
|
|
|
|
./respect-xml-catalog-files-var.patch
|
2020-02-07 22:55:16 +01:00
|
|
|
|
|
|
|
|
|
# Don’t hardcode flatpak binary path in launchers stored under user’s profile otherwise they will break after Flatpak update.
|
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/43581
|
2018-07-19 10:52:59 +02:00
|
|
|
|
./use-flatpak-from-path.patch
|
2020-02-07 22:55:16 +01:00
|
|
|
|
|
2021-03-13 18:40:46 +01:00
|
|
|
|
# Hardcode flatpak binary path for flatpak-spawn.
|
|
|
|
|
# When calling the portal’s Spawn command with FLATPAK_SPAWN_FLAGS_CLEAR_ENV flag,
|
|
|
|
|
# it will clear environment, including PATH, making the flatpak run fail.
|
|
|
|
|
# https://github.com/flatpak/flatpak/pull/4174
|
|
|
|
|
(fetchpatch {
|
|
|
|
|
url = "https://github.com/flatpak/flatpak/commit/495449daf6d3c072519a36c9e4bc6cc1da4d31db.patch";
|
|
|
|
|
sha256 = "gOX/sGupAE7Yg3MVrMhFXzWHpFn+izVyjtkuPzIckuY=";
|
|
|
|
|
})
|
|
|
|
|
|
2020-02-07 22:55:16 +01:00
|
|
|
|
# Nix environment hacks should not leak into the apps.
|
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/53441
|
2019-04-16 04:47:23 +02:00
|
|
|
|
./unset-env-vars.patch
|
2020-02-07 22:55:16 +01:00
|
|
|
|
|
|
|
|
|
# But we want the GDK_PIXBUF_MODULE_FILE from the wrapper affect the icon validator.
|
2019-06-14 13:56:06 +02:00
|
|
|
|
./validate-icon-pixbuf.patch
|
2017-10-02 15:40:26 +02:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-02-01 21:53:32 +01:00
|
|
|
|
autoreconfHook
|
2020-02-07 22:55:16 +01:00
|
|
|
|
libxml2
|
2021-02-01 21:53:32 +01:00
|
|
|
|
docbook_xml_dtd_45
|
2020-07-24 09:04:16 +02:00
|
|
|
|
docbook-xsl-nons
|
2020-02-07 22:55:16 +01:00
|
|
|
|
which
|
|
|
|
|
gobject-introspection
|
|
|
|
|
gtk-doc
|
|
|
|
|
intltool
|
|
|
|
|
libxslt
|
2020-07-24 09:04:16 +02:00
|
|
|
|
pkg-config
|
2020-02-07 22:55:16 +01:00
|
|
|
|
xmlto
|
|
|
|
|
appstream-glib
|
2021-03-14 18:50:12 +01:00
|
|
|
|
bison
|
2021-02-01 21:53:32 +01:00
|
|
|
|
wrapGAppsNoGuiHook
|
2018-09-06 11:38:09 +02:00
|
|
|
|
];
|
2017-10-02 15:40:26 +02:00
|
|
|
|
|
|
|
|
|
buildInputs = [
|
2020-02-07 22:55:16 +01:00
|
|
|
|
bubblewrap
|
|
|
|
|
bzip2
|
|
|
|
|
dbus
|
|
|
|
|
dconf
|
|
|
|
|
gpgme
|
|
|
|
|
json-glib
|
|
|
|
|
libarchive
|
|
|
|
|
libcap
|
|
|
|
|
libseccomp
|
|
|
|
|
libsoup
|
2021-03-14 19:12:53 +01:00
|
|
|
|
xz
|
2021-02-01 21:53:32 +01:00
|
|
|
|
zstd
|
2020-02-07 22:55:16 +01:00
|
|
|
|
polkit
|
|
|
|
|
python3
|
|
|
|
|
systemd
|
|
|
|
|
xorg.libXau
|
|
|
|
|
fuse
|
|
|
|
|
gsettings-desktop-schemas
|
|
|
|
|
glib-networking
|
2019-06-15 07:15:01 +02:00
|
|
|
|
librsvg # for flatpak-validate-icon
|
2017-10-02 15:40:26 +02:00
|
|
|
|
];
|
|
|
|
|
|
2020-02-18 00:32:35 +01:00
|
|
|
|
# Required by flatpak.pc
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
|
glib
|
|
|
|
|
ostree
|
|
|
|
|
];
|
|
|
|
|
|
2020-02-07 22:55:16 +01:00
|
|
|
|
checkInputs = [
|
|
|
|
|
valgrind
|
|
|
|
|
];
|
2017-10-02 15:40:26 +02:00
|
|
|
|
|
2020-02-07 22:55:16 +01:00
|
|
|
|
# TODO: some issues with temporary files
|
|
|
|
|
doCheck = false;
|
2017-10-02 15:40:26 +02:00
|
|
|
|
|
2019-10-30 02:29:30 +01:00
|
|
|
|
NIX_LDFLAGS = "-lpthread";
|
2019-01-04 20:33:50 +01:00
|
|
|
|
|
2017-10-02 15:40:26 +02:00
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
|
"--with-system-bubblewrap=${bubblewrap}/bin/bwrap"
|
2018-09-06 11:38:09 +02:00
|
|
|
|
"--with-system-dbus-proxy=${xdg-dbus-proxy}/bin/xdg-dbus-proxy"
|
2019-10-13 14:03:25 +02:00
|
|
|
|
"--with-dbus-config-dir=${placeholder "out"}/share/dbus-1/system.d"
|
2017-10-02 15:40:26 +02:00
|
|
|
|
"--localstatedir=/var"
|
2020-07-24 09:04:16 +02:00
|
|
|
|
"--enable-gtk-doc"
|
2017-10-02 15:40:26 +02:00
|
|
|
|
"--enable-installed-tests"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
makeFlags = [
|
2020-02-07 22:55:16 +01:00
|
|
|
|
"installed_testdir=${placeholder "installedTests"}/libexec/installed-tests/flatpak"
|
|
|
|
|
"installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/flatpak"
|
2017-10-02 15:40:26 +02:00
|
|
|
|
];
|
|
|
|
|
|
2020-07-24 09:04:16 +02:00
|
|
|
|
postPatch = let
|
|
|
|
|
vsc-py = python3.withPackages (pp: [
|
|
|
|
|
pp.pyparsing
|
|
|
|
|
]);
|
|
|
|
|
in ''
|
2017-10-02 15:40:26 +02:00
|
|
|
|
patchShebangs buildutil
|
|
|
|
|
patchShebangs tests
|
2021-01-21 18:00:13 +01:00
|
|
|
|
PATH=${lib.makeBinPath [vsc-py]}:$PATH patchShebangs --build variant-schema-compiler/variant-schema-compiler
|
2020-07-24 09:04:16 +02:00
|
|
|
|
'';
|
|
|
|
|
|
2019-11-07 14:38:31 +01:00
|
|
|
|
passthru = {
|
|
|
|
|
tests = {
|
|
|
|
|
installedTests = nixosTests.installed-tests.flatpak;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2021-01-21 18:00:13 +01:00
|
|
|
|
meta = with lib; {
|
2017-10-02 15:40:26 +02:00
|
|
|
|
description = "Linux application sandboxing and distribution framework";
|
2020-02-07 22:55:16 +01:00
|
|
|
|
homepage = "https://flatpak.org/";
|
2021-02-01 21:53:32 +01:00
|
|
|
|
license = licenses.lgpl21Plus;
|
2017-10-02 15:40:26 +02:00
|
|
|
|
maintainers = with maintainers; [ jtojnar ];
|
|
|
|
|
platforms = platforms.linux;
|
|
|
|
|
};
|
|
|
|
|
}
|