nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 fetchurl,
3 runCommand,
4 lib,
5 stdenv,
6 pkg-config,
7 gettext,
8 gobject-introspection,
9 cairo,
10 colord,
11 docutils,
12 lcms2,
13 pango,
14 libstartup_notification,
15 libcanberra,
16 ninja,
17 xvfb-run,
18 libadwaita,
19 libxcvt,
20 libGL,
21 libICE,
22 libX11,
23 libXcomposite,
24 libXcursor,
25 libXdamage,
26 libXext,
27 libXfixes,
28 libXi,
29 libXtst,
30 libxkbfile,
31 xkeyboard_config,
32 libxkbcommon,
33 libxcb,
34 libXrandr,
35 libXinerama,
36 libXau,
37 libinput,
38 libdrm,
39 libgbm,
40 libei,
41 libdisplay-info,
42 gsettings-desktop-schemas,
43 glib,
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 = "48.7";
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-7BAqo8uw45ABIGYnrKMFUxRVX3BgneXmwrfvzR+pDyA=";
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 gnome-desktop
134 gnome-settings-daemon
135 gsettings-desktop-schemas
136 atk
137 fribidi
138 harfbuzz
139 libcanberra
140 libdrm
141 libgbm
142 libei
143 libdisplay-info
144 libGL
145 libgudev
146 libinput
147 libstartup_notification
148 libwacom
149 libSM
150 colord
151 lcms2
152 pango
153 pipewire
154 sysprof # for D-Bus interfaces
155 libsysprof-capture
156 xwayland
157 wayland
158 wayland-protocols
159 # X11 client
160 gtk4
161 libICE
162 libX11
163 libXcomposite
164 libXcursor
165 libXdamage
166 libXext
167 libXfixes
168 libXi
169 libXtst
170 libxkbfile
171 xkeyboard_config
172 libxkbcommon
173 libxcb
174 libXrandr
175 libXinerama
176 libXau
177
178 # for gdctl shebang
179 (python3.withPackages (pp: [
180 pp.pygobject3
181 pp.argcomplete
182 ]))
183 ];
184
185 postPatch = ''
186 patchShebangs src/backends/native/gen-default-modes.py
187
188 # https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3981
189 substituteInPlace src/frames/main.c \
190 --replace-fail "libadwaita-1.so.0" "${libadwaita}/lib/libadwaita-1.so.0"
191 '';
192
193 postFixup = ''
194 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
195 # TODO: Move this into a directory devhelp can find.
196 moveToOutput "share/mutter-${finalAttrs.passthru.libmutter_api_version}/doc" "$devdoc"
197 '';
198
199 # Install udev files into our own tree.
200 env.PKG_CONFIG_UDEV_UDEVDIR = "${placeholder "out"}/lib/udev";
201
202 separateDebugInfo = true;
203 strictDeps = true;
204
205 doInstallCheck = true;
206
207 passthru = {
208 libmutter_api_version = "16"; # bumped each dev cycle
209 libdir = "${finalAttrs.finalPackage}/lib/mutter-${finalAttrs.passthru.libmutter_api_version}";
210
211 tests = {
212 libdirExists = runCommand "mutter-libdir-exists" { } ''
213 if [[ ! -d ${finalAttrs.finalPackage.libdir} ]]; then
214 echo "passthru.libdir should contain a directory, “${finalAttrs.finalPackage.libdir}” is not one."
215 exit 1
216 fi
217 touch $out
218 '';
219 };
220 };
221
222 meta = {
223 description = "Window manager for GNOME";
224 mainProgram = "mutter";
225 homepage = "https://gitlab.gnome.org/GNOME/mutter";
226 changelog = "https://gitlab.gnome.org/GNOME/mutter/-/blob/${finalAttrs.version}/NEWS?ref_type=tags";
227 license = lib.licenses.gpl2Plus;
228 teams = [ lib.teams.pantheon ];
229 platforms = lib.platforms.linux;
230 };
231})