Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 209 lines 4.7 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.4"; 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-ijTb0LZ8Q051mLmOxpCVPQRvDbJuSArq+0bXKuxxZ5k="; # 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 # The icon validator needs to access the gdk-pixbuf loaders in the Nix store 93 # and cannot bind FHS paths since those are not available on NixOS. 94 finalAttrs.passthru.icon-validator-patch 95 ]; 96 97 nativeBuildInputs = [ 98 autoreconfHook 99 libxml2 100 docbook_xml_dtd_45 101 docbook-xsl-nons 102 which 103 gobject-introspection 104 gtk-doc 105 intltool 106 libxslt 107 pkg-config 108 xmlto 109 bison 110 wrapGAppsNoGuiHook 111 ]; 112 113 buildInputs = [ 114 appstream 115 bubblewrap 116 bzip2 117 curl 118 dbus 119 dconf 120 gpgme 121 json-glib 122 libarchive 123 libcap 124 libseccomp 125 xz 126 zstd 127 polkit 128 python3 129 systemd 130 xorg.libXau 131 fuse3 132 gsettings-desktop-schemas 133 glib-networking 134 librsvg # for flatpak-validate-icon 135 ]; 136 137 # Required by flatpak.pc 138 propagatedBuildInputs = [ 139 glib 140 ostree 141 ]; 142 143 nativeCheckInputs = [ 144 valgrind 145 ]; 146 147 # TODO: some issues with temporary files 148 doCheck = false; 149 150 NIX_LDFLAGS = "-lpthread"; 151 152 enableParallelBuilding = true; 153 154 configureFlags = [ 155 "--with-curl" 156 "--with-system-bubblewrap=${bubblewrap}/bin/bwrap" 157 "--with-system-dbus-proxy=${xdg-dbus-proxy}/bin/xdg-dbus-proxy" 158 "--with-dbus-config-dir=${placeholder "out"}/share/dbus-1/system.d" 159 "--localstatedir=/var" 160 "--enable-gtk-doc" 161 "--enable-installed-tests" 162 ]; 163 164 makeFlags = [ 165 "installed_testdir=${placeholder "installedTests"}/libexec/installed-tests/flatpak" 166 "installed_test_metadir=${placeholder "installedTests"}/share/installed-tests/flatpak" 167 ]; 168 169 postPatch = let 170 vsc-py = python3.withPackages (pp: [ 171 pp.pyparsing 172 ]); 173 in '' 174 patchShebangs buildutil 175 patchShebangs tests 176 PATH=${lib.makeBinPath [vsc-py]}:$PATH patchShebangs --build subprojects/variant-schema-compiler/variant-schema-compiler 177 ''; 178 179 preFixup = '' 180 gappsWrapperArgs+=( 181 # Use flatpak from PATH in exported assets (e.g. desktop files). 182 --set FLATPAK_BINARY flatpak 183 ) 184 ''; 185 186 passthru = { 187 icon-validator-patch = substituteAll { 188 src = ./fix-icon-validation.patch; 189 inherit (builtins) storeDir; 190 }; 191 192 tests = { 193 installedTests = nixosTests.installed-tests.flatpak; 194 195 validate-icon = runCommand "test-icon-validation" { } '' 196 ${finalAttrs.finalPackage}/libexec/flatpak-validate-icon --sandbox 512 512 ${../../../applications/audio/zynaddsubfx/ZynLogo.svg} > "$out" 197 grep format=svg "$out" 198 ''; 199 }; 200 }; 201 202 meta = with lib; { 203 description = "Linux application sandboxing and distribution framework"; 204 homepage = "https://flatpak.org/"; 205 license = licenses.lgpl21Plus; 206 maintainers = with maintainers; [ ]; 207 platforms = platforms.linux; 208 }; 209})