1{
2 fetchurl,
3 runCommand,
4 lib,
5 stdenv,
6 pkg-config,
7 gnome,
8 gettext,
9 gobject-introspection,
10 cairo,
11 colord,
12 docutils,
13 lcms2,
14 pango,
15 libstartup_notification,
16 libcanberra,
17 ninja,
18 xvfb-run,
19 libadwaita,
20 libxcvt,
21 libGL,
22 libICE,
23 libX11,
24 libXcomposite,
25 libXcursor,
26 libXdamage,
27 libXext,
28 libXfixes,
29 libXi,
30 libXtst,
31 libxkbfile,
32 xkeyboard_config,
33 libxkbcommon,
34 libxcb,
35 libXrandr,
36 libXinerama,
37 libXau,
38 libinput,
39 libdrm,
40 libgbm,
41 libei,
42 libdisplay-info,
43 gsettings-desktop-schemas,
44 glib,
45 atk,
46 gtk4,
47 fribidi,
48 harfbuzz,
49 gnome-desktop,
50 pipewire,
51 libgudev,
52 libwacom,
53 libSM,
54 xwayland,
55 mesa-gl-headers,
56 meson,
57 gnome-settings-daemon,
58 xorgserver,
59 python3,
60 wayland-scanner,
61 wrapGAppsHook4,
62 gi-docgen,
63 sysprof,
64 libsysprof-capture,
65 desktop-file-utils,
66 egl-wayland,
67 graphene,
68 udevCheckHook,
69 wayland,
70 wayland-protocols,
71}:
72
73stdenv.mkDerivation (finalAttrs: {
74 pname = "mutter";
75 version = "48.4";
76
77 outputs = [
78 "out"
79 "dev"
80 "man"
81 "devdoc"
82 ];
83
84 src = fetchurl {
85 url = "mirror://gnome/sources/mutter/${lib.versions.major finalAttrs.version}/mutter-${finalAttrs.version}.tar.xz";
86 hash = "sha256-EYnPfmPMh8/dHzqG6PFNl8M9ap2iVPI+gWVVSbbFDZM=";
87 };
88
89 mesonFlags = [
90 "-Degl_device=true"
91 "-Dinstalled_tests=false" # TODO: enable these
92 "-Dtests=disabled"
93 # For NVIDIA proprietary driver up to 470.
94 # https://src.fedoraproject.org/rpms/mutter/pull-request/49
95 "-Dwayland_eglstream=true"
96 "-Dprofiler=true"
97 "-Dxwayland_path=${lib.getExe xwayland}"
98 # This should be auto detected, but it looks like it manages a false
99 # positive.
100 "-Dxwayland_initfd=disabled"
101 "-Ddocs=true"
102 ];
103
104 propagatedBuildInputs = [
105 # required for pkg-config to detect mutter-mtk
106 graphene
107 mesa-gl-headers
108 ];
109
110 nativeBuildInputs = [
111 desktop-file-utils
112 docutils # for rst2man
113 gettext
114 glib
115 libxcvt
116 meson
117 ninja
118 xvfb-run
119 pkg-config
120 python3
121 python3.pkgs.argcomplete # for register-python-argcomplete
122 wayland-scanner
123 wrapGAppsHook4
124 gi-docgen
125 xorgserver
126 gobject-introspection
127 udevCheckHook
128 ];
129
130 buildInputs = [
131 cairo
132 egl-wayland
133 glib
134 gnome-desktop
135 gnome-settings-daemon
136 gsettings-desktop-schemas
137 atk
138 fribidi
139 harfbuzz
140 libcanberra
141 libdrm
142 libgbm
143 libei
144 libdisplay-info
145 libGL
146 libgudev
147 libinput
148 libstartup_notification
149 libwacom
150 libSM
151 colord
152 lcms2
153 pango
154 pipewire
155 sysprof # for D-Bus interfaces
156 libsysprof-capture
157 xwayland
158 wayland
159 wayland-protocols
160 # X11 client
161 gtk4
162 libICE
163 libX11
164 libXcomposite
165 libXcursor
166 libXdamage
167 libXext
168 libXfixes
169 libXi
170 libXtst
171 libxkbfile
172 xkeyboard_config
173 libxkbcommon
174 libxcb
175 libXrandr
176 libXinerama
177 libXau
178
179 # for gdctl shebang
180 (python3.withPackages (pp: [
181 pp.pygobject3
182 pp.argcomplete
183 ]))
184 ];
185
186 postPatch = ''
187 patchShebangs src/backends/native/gen-default-modes.py
188
189 # https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3981
190 substituteInPlace src/frames/main.c \
191 --replace-fail "libadwaita-1.so.0" "${libadwaita}/lib/libadwaita-1.so.0"
192 '';
193
194 postFixup = ''
195 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
196 # TODO: Move this into a directory devhelp can find.
197 moveToOutput "share/mutter-${finalAttrs.passthru.libmutter_api_version}/doc" "$devdoc"
198 '';
199
200 # Install udev files into our own tree.
201 PKG_CONFIG_UDEV_UDEVDIR = "${placeholder "out"}/lib/udev";
202
203 separateDebugInfo = true;
204 strictDeps = true;
205
206 doInstallCheck = true;
207
208 passthru = {
209 libmutter_api_version = "16"; # bumped each dev cycle
210 libdir = "${finalAttrs.finalPackage}/lib/mutter-${finalAttrs.passthru.libmutter_api_version}";
211
212 tests = {
213 libdirExists = runCommand "mutter-libdir-exists" { } ''
214 if [[ ! -d ${finalAttrs.finalPackage.libdir} ]]; then
215 echo "passthru.libdir should contain a directory, “${finalAttrs.finalPackage.libdir}” is not one."
216 exit 1
217 fi
218 touch $out
219 '';
220 };
221
222 updateScript = gnome.updateScript {
223 packageName = "mutter";
224 };
225 };
226
227 meta = with lib; {
228 description = "Window manager for GNOME";
229 mainProgram = "mutter";
230 homepage = "https://gitlab.gnome.org/GNOME/mutter";
231 changelog = "https://gitlab.gnome.org/GNOME/mutter/-/blob/${finalAttrs.version}/NEWS?ref_type=tags";
232 license = licenses.gpl2Plus;
233 teams = [ teams.gnome ];
234 platforms = platforms.linux;
235 };
236})