nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 libX11,
23 libXcomposite,
24 libXcursor,
25 libXdamage,
26 libXext,
27 libXfixes,
28 libXi,
29 xkeyboard_config,
30 libxkbcommon,
31 libxcb,
32 libXrandr,
33 libXinerama,
34 libXau,
35 libinput,
36 libdrm,
37 libgbm,
38 libei,
39 libepoxy,
40 libdisplay-info,
41 gsettings-desktop-schemas,
42 glib,
43 libglycin,
44 atk,
45 gtk4,
46 fribidi,
47 harfbuzz,
48 gnome-desktop,
49 pipewire,
50 libgudev,
51 libwacom,
52 libSM,
53 xwayland,
54 mesa-gl-headers,
55 meson,
56 gnome-settings-daemon,
57 xorgserver,
58 python3,
59 wayland-scanner,
60 wrapGAppsHook4,
61 gi-docgen,
62 sysprof,
63 libsysprof-capture,
64 desktop-file-utils,
65 egl-wayland,
66 graphene,
67 udevCheckHook,
68 wayland,
69 wayland-protocols,
70}:
71
72stdenv.mkDerivation (finalAttrs: {
73 pname = "mutter";
74 version = "49.3";
75
76 outputs = [
77 "out"
78 "dev"
79 "man"
80 "devdoc"
81 ];
82
83 src = fetchurl {
84 url = "mirror://gnome/sources/mutter/${lib.versions.major finalAttrs.version}/mutter-${finalAttrs.version}.tar.xz";
85 hash = "sha256-nvH2HW/kAcyj/L5tmjsqT5tCY4y/hENzVmamGWSo8MM=";
86 };
87
88 mesonFlags = [
89 "-Degl_device=true"
90 "-Dinstalled_tests=false" # TODO: enable these
91 "-Dtests=disabled"
92 # For NVIDIA proprietary driver up to 470.
93 # https://src.fedoraproject.org/rpms/mutter/pull-request/49
94 "-Dwayland_eglstream=true"
95 "-Dprofiler=true"
96 "-Dxwayland_path=${lib.getExe xwayland}"
97 # This should be auto detected, but it looks like it manages a false
98 # positive.
99 "-Dxwayland_initfd=disabled"
100 "-Ddocs=true"
101 ];
102
103 propagatedBuildInputs = [
104 # required for pkg-config to detect mutter-mtk
105 graphene
106 mesa-gl-headers
107 ];
108
109 nativeBuildInputs = [
110 desktop-file-utils
111 docutils # for rst2man
112 gettext
113 glib
114 libxcvt
115 meson
116 ninja
117 xvfb-run
118 pkg-config
119 python3
120 python3.pkgs.argcomplete # for register-python-argcomplete
121 wayland-scanner
122 wrapGAppsHook4
123 gi-docgen
124 xorgserver
125 gobject-introspection
126 udevCheckHook
127 ];
128
129 buildInputs = [
130 cairo
131 egl-wayland
132 glib
133 libglycin
134 gnome-desktop
135 gnome-settings-daemon
136 gsettings-desktop-schemas
137 atk
138 fribidi
139 harfbuzz
140 libcanberra
141 libdrm
142 libadwaita
143 libgbm
144 libei
145 libepoxy
146 libdisplay-info
147 libGL
148 libgudev
149 libinput
150 libstartup_notification
151 libwacom
152 libSM
153 colord
154 lcms2
155 pango
156 pipewire
157 sysprof # for D-Bus interfaces
158 libsysprof-capture
159 xwayland
160 wayland
161 wayland-protocols
162 # X11 client
163 gtk4
164 libX11
165 libXcomposite
166 libXcursor
167 libXdamage
168 libXext
169 libXfixes
170 libXi
171 xkeyboard_config
172 libxkbcommon
173 libxcb
174 libXrandr
175 libXinerama
176 libXau
177
178 # for gdctl and gnome-service-client shebangs
179 (python3.withPackages (pp: [
180 pp.dbus-python
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 env.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 = "17"; # 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 = {
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 = lib.licenses.gpl2Plus;
233 teams = [ lib.teams.gnome ];
234 platforms = lib.platforms.linux;
235 };
236})