Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 meson, 6 ninja, 7 pkg-config, 8 glib, 9 pcre2, 10 gtk4, 11 pango, 12 fribidi, 13 vala, 14 gi-docgen, 15 libxml2, 16 perl, 17 gettext, 18 gnome, 19 gobject-introspection, 20 dbus, 21 xvfb-run, 22 shared-mime-info, 23 testers, 24}: 25 26stdenv.mkDerivation (finalAttrs: { 27 pname = "gtksourceview"; 28 version = "5.16.0"; 29 30 outputs = [ 31 "out" 32 "dev" 33 "devdoc" 34 ]; 35 36 src = fetchurl { 37 url = "mirror://gnome/sources/gtksourceview/${lib.versions.majorMinor finalAttrs.version}/gtksourceview-${finalAttrs.version}.tar.xz"; 38 hash = "sha256-qzXUIBAvPosFXdO4ZC06SCCfiIGJ5iVND/tLan6MNWY="; 39 }; 40 41 patches = [ 42 # By default, the library loads syntaxes from XDG_DATA_DIRS and user directory 43 # but not from its own datadr (it assumes it will be in XDG_DATA_DIRS). 44 # Since this is not generally true with Nix, let’s add $out/share unconditionally. 45 ./4.x-nix_share_path.patch 46 ]; 47 48 nativeBuildInputs = [ 49 meson 50 ninja 51 pkg-config 52 gettext 53 perl 54 gobject-introspection 55 vala 56 gi-docgen 57 gtk4 # for gtk4-update-icon-cache checked during configure 58 ]; 59 60 buildInputs = [ 61 glib 62 pcre2 63 pango 64 fribidi 65 libxml2 66 ]; 67 68 propagatedBuildInputs = [ 69 # Required by gtksourceview-5.0.pc 70 gtk4 71 # Used by gtk_source_language_manager_guess_language 72 shared-mime-info 73 ]; 74 75 nativeCheckInputs = [ 76 xvfb-run 77 dbus 78 ]; 79 80 mesonFlags = [ 81 "-Ddocumentation=true" 82 ]; 83 84 doCheck = stdenv.hostPlatform.isLinux; 85 86 checkPhase = '' 87 runHook preCheck 88 89 env \ 90 XDG_DATA_DIRS="$XDG_DATA_DIRS:${shared-mime-info}/share" \ 91 GTK_A11Y=none \ 92 xvfb-run -s '-screen 0 800x600x24' dbus-run-session \ 93 --config-file=${dbus}/share/dbus-1/session.conf \ 94 meson test --no-rebuild --print-errorlogs 95 96 runHook postCheck 97 ''; 98 99 postFixup = '' 100 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. 101 moveToOutput "share/doc" "$devdoc" 102 ''; 103 104 passthru = { 105 updateScript = gnome.updateScript { 106 packageName = "gtksourceview"; 107 attrPath = "gtksourceview5"; 108 versionPolicy = "odd-unstable"; 109 }; 110 }; 111 112 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 113 114 meta = with lib; { 115 description = "Source code editing widget for GTK"; 116 homepage = "https://gitlab.gnome.org/GNOME/gtksourceview"; 117 pkgConfigModules = [ "gtksourceview-5" ]; 118 platforms = platforms.unix; 119 license = licenses.lgpl21Plus; 120 teams = [ teams.gnome ]; 121 }; 122})