lol
1{ lib
2, stdenv
3, fetchurl
4, meson
5, ninja
6, pkg-config
7, atk
8, cairo
9, glib
10, gtk3
11, pango
12, fribidi
13, vala
14, libxml2
15, perl
16, gettext
17, gnome
18, gobject-introspection
19, dbus
20, xvfb-run
21, shared-mime-info
22}:
23
24stdenv.mkDerivation rec {
25 pname = "gtksourceview";
26 version = "4.8.2";
27
28 outputs = [ "out" "dev" ];
29
30 src = fetchurl {
31 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
32 sha256 = "1k1pava84ywgq62xl5bz8y3zm7z2kz6kkgp423c0y02jrgjyfbc4";
33 };
34
35 patches = [
36 # By default, the library loads syntaxes from XDG_DATA_DIRS and user directory
37 # but not from its own datadr (it assumes it will be in XDG_DATA_DIRS).
38 # Since this is not generally true with Nix, let’s add $out/share unconditionally.
39 ./4.x-nix_share_path.patch
40 ];
41
42 nativeBuildInputs = [
43 meson
44 ninja
45 pkg-config
46 gettext
47 perl
48 gobject-introspection
49 vala
50 ];
51
52 buildInputs = [
53 atk
54 cairo
55 glib
56 pango
57 fribidi
58 libxml2
59 ];
60
61 propagatedBuildInputs = [
62 # Required by gtksourceview-4.0.pc
63 gtk3
64 # Used by gtk_source_language_manager_guess_language
65 shared-mime-info
66 ];
67
68 checkInputs = [
69 xvfb-run
70 dbus
71 ];
72
73 doCheck = stdenv.isLinux;
74
75 checkPhase = ''
76 runHook preCheck
77
78 XDG_DATA_DIRS="$XDG_DATA_DIRS:${shared-mime-info}/share" \
79 xvfb-run -s '-screen 0 800x600x24' dbus-run-session \
80 --config-file=${dbus.daemon}/share/dbus-1/session.conf \
81 meson test --no-rebuild --print-errorlogs
82
83 runHook postCheck
84 '';
85
86 passthru = {
87 updateScript = gnome.updateScript {
88 packageName = "gtksourceview";
89 attrPath = "gtksourceview4";
90 versionPolicy = "odd-unstable";
91 freeze = true;
92 };
93 };
94
95 meta = with lib; {
96 description = "Source code editing widget for GTK";
97 homepage = "https://wiki.gnome.org/Projects/GtkSourceView";
98 platforms = platforms.unix;
99 license = licenses.lgpl21Plus;
100 maintainers = teams.gnome.members;
101 };
102}