Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchpatch2, 6 meson, 7 ninja, 8 pkg-config, 9 atk, 10 cairo, 11 glib, 12 gtk3, 13 pango, 14 fribidi, 15 vala, 16 libxml2, 17 perl, 18 gettext, 19 gnome, 20 gobject-introspection, 21 dbus, 22 xvfb-run, 23 shared-mime-info, 24 testers, 25}: 26 27stdenv.mkDerivation (finalAttrs: { 28 pname = "gtksourceview"; 29 version = "4.8.4"; 30 31 outputs = [ 32 "out" 33 "dev" 34 ]; 35 36 src = 37 let 38 inherit (finalAttrs) pname version; 39 in 40 fetchurl { 41 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; 42 sha256 = "fsnRj7KD0fhKOj7/O3pysJoQycAGWXs/uru1lYQgqH0="; 43 }; 44 45 patches = [ 46 # By default, the library loads syntaxes from XDG_DATA_DIRS and user directory 47 # but not from its own datadr (it assumes it will be in XDG_DATA_DIRS). 48 # Since this is not generally true with Nix, let’s add $out/share unconditionally. 49 ./4.x-nix_share_path.patch 50 51 # nix.lang: Add Nix syntax highlighting 52 # https://gitlab.gnome.org/GNOME/gtksourceview/-/merge_requests/303 53 (fetchpatch2 { 54 url = "https://gitlab.gnome.org/GNOME/gtksourceview/-/commit/685b3bd08869c2aefe33fad696a7f5f2dc831016.patch"; 55 hash = "sha256-yeYXJ2l/QS857C4UXOnMFyh0JsptA0TQt0lfD7wN5ic="; 56 }) 57 58 # nix.lang: fix section name 59 (fetchpatch2 { 60 url = "https://gitlab.gnome.org/GNOME/gtksourceview/-/commit/1dbbb01da98140e0b2d5d0c6c2df29247650ed83.patch"; 61 hash = "sha256-6HxLKQyI5DDvmKhmldQlwVPV62RfFa2gwWbcHA2cICs="; 62 }) 63 ]; 64 65 nativeBuildInputs = [ 66 meson 67 ninja 68 pkg-config 69 gettext 70 perl 71 gobject-introspection 72 vala 73 ]; 74 75 buildInputs = [ 76 atk 77 cairo 78 glib 79 pango 80 fribidi 81 libxml2 82 ]; 83 84 propagatedBuildInputs = [ 85 # Required by gtksourceview-4.0.pc 86 gtk3 87 # Used by gtk_source_language_manager_guess_language 88 shared-mime-info 89 ]; 90 91 nativeCheckInputs = [ 92 xvfb-run 93 dbus 94 ]; 95 96 postPatch = '' 97 # https://gitlab.gnome.org/GNOME/gtksourceview/-/merge_requests/295 98 # build: drop unnecessary vapigen check 99 substituteInPlace meson.build \ 100 --replace "if generate_vapi" "if false" 101 ''; 102 103 # Broken by PCRE 2 bump in GLib. 104 # https://gitlab.gnome.org/GNOME/gtksourceview/-/issues/283 105 doCheck = false; 106 107 checkPhase = '' 108 runHook preCheck 109 110 XDG_DATA_DIRS="$XDG_DATA_DIRS:${shared-mime-info}/share" \ 111 xvfb-run -s '-screen 0 800x600x24' dbus-run-session \ 112 --config-file=${dbus}/share/dbus-1/session.conf \ 113 meson test --no-rebuild --print-errorlogs 114 115 runHook postCheck 116 ''; 117 118 passthru = { 119 updateScript = gnome.updateScript { 120 packageName = "gtksourceview"; 121 attrPath = "gtksourceview4"; 122 versionPolicy = "odd-unstable"; 123 freeze = true; 124 }; 125 }; 126 127 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; 128 129 meta = with lib; { 130 description = "Source code editing widget for GTK"; 131 homepage = "https://gitlab.gnome.org/GNOME/gtksourceview"; 132 pkgConfigModules = [ "gtksourceview-4" ]; 133 platforms = platforms.unix; 134 license = licenses.lgpl21Plus; 135 teams = [ teams.gnome ]; 136 }; 137})