at 23.05-pre 213 lines 4.8 kB view raw
1{ lib, stdenv 2, fetchurl 3, autoreconfHook 4, docbook_xml_dtd_45 5, docbook-xsl-nons 6, which 7, libxml2 8, gobject-introspection 9, gtk-doc 10, intltool 11, libxslt 12, pkg-config 13, xmlto 14, substituteAll 15, runCommand 16, bison 17, xdg-dbus-proxy 18, p11-kit 19, appstream 20, bubblewrap 21, bzip2 22, curl 23, dbus 24, glib 25, gpgme 26, json-glib 27, libarchive 28, libcap 29, libseccomp 30, coreutils 31, socat 32, gettext 33, hicolor-icon-theme 34, shared-mime-info 35, desktop-file-utils 36, gtk3 37, fuse3 38, nixosTests 39, xz 40, zstd 41, ostree 42, polkit 43, python3 44, systemd 45, xorg 46, valgrind 47, glib-networking 48, wrapGAppsNoGuiHook 49, dconf 50, gsettings-desktop-schemas 51, librsvg 52, makeWrapper 53}: 54 55stdenv.mkDerivation (finalAttrs: { 56 pname = "flatpak"; 57 version = "1.14.0"; 58 59 # TODO: split out lib once we figure out what to do with triggerdir 60 outputs = [ "out" "dev" "man" "doc" "devdoc" "installedTests" ]; 61 62 src = fetchurl { 63 url = "https://github.com/flatpak/flatpak/releases/download/${finalAttrs.version}/flatpak-${finalAttrs.version}.tar.xz"; 64 sha256 = "sha256-jidpc3cOok3fJZetSuzTa5g5PmvekeSOF0OqymfyeBU="; # Taken from https://github.com/flatpak/flatpak/releases/ 65 }; 66 67 patches = [ 68 # Hardcode paths used by tests and change test runtime generation to use files from Nix store. 69 # https://github.com/flatpak/flatpak/issues/1460 70 (substituteAll { 71 src = ./fix-test-paths.patch; 72 inherit coreutils gettext socat gtk3; 73 smi = shared-mime-info; 74 dfu = desktop-file-utils; 75 hicolorIconTheme = hicolor-icon-theme; 76 }) 77 78 # Hardcode paths used by Flatpak itself. 79 (substituteAll { 80 src = ./fix-paths.patch; 81 p11kit = "${p11-kit.bin}/bin/p11-kit"; 82 }) 83 84 # Allow gtk-doc to find schemas using XML_CATALOG_FILES environment variable. 85 # Patch taken from gtk-doc expression. 86 ./respect-xml-catalog-files-var.patch 87 88 # Nix environment hacks should not leak into the apps. 89 # https://github.com/NixOS/nixpkgs/issues/53441 90 ./unset-env-vars.patch 91 92 # Do not clear XDG_DATA_DIRS in fish shell 93 # https://github.com/flatpak/flatpak/pull/5123 94 ./no-breaking-fish.patch 95 96 # The icon validator needs to access the gdk-pixbuf loaders in the Nix store 97 # and cannot bind FHS paths since those are not available on NixOS. 98 finalAttrs.passthru.icon-validator-patch 99 ]; 100 101 nativeBuildInputs = [ 102 autoreconfHook 103 libxml2 104 docbook_xml_dtd_45 105 docbook-xsl-nons 106 which 107 gobject-introspection 108 gtk-doc 109 intltool 110 libxslt 111 pkg-config 112 xmlto 113 bison 114 wrapGAppsNoGuiHook 115 ]; 116 117 buildInputs = [ 118 appstream 119 bubblewrap 120 bzip2 121 curl 122 dbus 123 dconf 124 gpgme 125 json-glib 126 libarchive 127 libcap 128 libseccomp 129 xz 130 zstd 131 polkit 132 python3 133 systemd 134 xorg.libXau 135 fuse3 136 gsettings-desktop-schemas 137 glib-networking 138 librsvg # for flatpak-validate-icon 139 ]; 140 141 # Required by flatpak.pc 142 propagatedBuildInputs = [ 143 glib 144 ostree 145 ]; 146 147 checkInputs = [ 148 valgrind 149 ]; 150 151 # TODO: some issues with temporary files 152 doCheck = false; 153 154 NIX_LDFLAGS = "-lpthread"; 155 156 enableParallelBuilding = true; 157 158 configureFlags = [ 159 "--with-curl" 160 "--with-system-bubblewrap=${bubblewrap}/bin/bwrap" 161 "--with-system-dbus-proxy=${xdg-dbus-proxy}/bin/xdg-dbus-proxy" 162 "--with-dbus-config-dir=${placeholder "out"}/share/dbus-1/system.d" 163 "--localstatedir=/var" 164 "--enable-gtk-doc" 165 "--enable-installed-tests" 166 ]; 167 168 makeFlags = [ 169 "installed_testdir=${placeholder "installedTests"}/libexec/installed-tests/flatpak" 170 "installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/flatpak" 171 ]; 172 173 postPatch = let 174 vsc-py = python3.withPackages (pp: [ 175 pp.pyparsing 176 ]); 177 in '' 178 patchShebangs buildutil 179 patchShebangs tests 180 PATH=${lib.makeBinPath [vsc-py]}:$PATH patchShebangs --build subprojects/variant-schema-compiler/variant-schema-compiler 181 ''; 182 183 preFixup = '' 184 gappsWrapperArgs+=( 185 # Use flatpak from PATH in exported assets (e.g. desktop files). 186 --set FLATPAK_BINARY flatpak 187 ) 188 ''; 189 190 passthru = { 191 icon-validator-patch = substituteAll { 192 src = ./fix-icon-validation.patch; 193 inherit (builtins) storeDir; 194 }; 195 196 tests = { 197 installedTests = nixosTests.installed-tests.flatpak; 198 199 validate-icon = runCommand "test-icon-validation" { } '' 200 ${finalAttrs.finalPackage}/libexec/flatpak-validate-icon --sandbox 512 512 ${../../../applications/audio/zynaddsubfx/ZynLogo.svg} > "$out" 201 grep format=svg "$out" 202 ''; 203 }; 204 }; 205 206 meta = with lib; { 207 description = "Linux application sandboxing and distribution framework"; 208 homepage = "https://flatpak.org/"; 209 license = licenses.lgpl21Plus; 210 maintainers = with maintainers; [ jtojnar ]; 211 platforms = platforms.linux; 212 }; 213})