nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitLab,
4 cpio,
5 ddcutil,
6 easyeffects,
7 gjs,
8 glib,
9 gnome-menus,
10 nautilus,
11 gobject-introspection,
12 hddtemp,
13 libgtop,
14 libhandy,
15 liquidctl,
16 lm_sensors,
17 netcat-gnu,
18 nvme-cli,
19 procps,
20 smartmontools,
21 replaceVars,
22 stdenvNoCC,
23 touchegg,
24 util-linux,
25 vte,
26 wrapGAppsHook3,
27 xdg-utils,
28 gtk4,
29 desktop-file-utils,
30 xdg-user-dirs,
31}:
32let
33 # Helper method to reduce redundancy
34 patchExtension =
35 name: override: super:
36 (
37 super
38 // {
39 ${name} = super.${name}.overrideAttrs override;
40 }
41 );
42in
43# A set of overrides for automatically packaged extensions that require some small fixes.
44# The input must be an attribute set with the extensions' UUIDs as keys and the extension
45# derivations as values. Output is the same, but with patches applied.
46#
47# Note that all source patches refer to the built extension as published on extensions.gnome.org, and not
48# the upstream repository's sources.
49super:
50lib.trivial.pipe super [
51 (patchExtension "apps-menu@gnome-shell-extensions.gcampax.github.com" (old: {
52 patches = [
53 (replaceVars
54 ./extensionOverridesPatches/apps-menu_at_gnome-shell-extensions.gcampax.github.com.patch
55 {
56 gmenu_path = "${gnome-menus}/lib/girepository-1.0";
57 }
58 )
59 ];
60 }))
61
62 (patchExtension "caffeine@patapon.info" (old: {
63 meta.maintainers = with lib.maintainers; [ eperuffo ];
64 }))
65
66 (patchExtension "dash-to-dock@micxgx.gmail.com" (old: {
67 meta.maintainers = with lib.maintainers; [ rhoriguchi ];
68 }))
69
70 (patchExtension "ddterm@amezin.github.com" (old: {
71 nativeBuildInputs = [
72 gobject-introspection
73 wrapGAppsHook3
74 ];
75 buildInputs = [
76 vte
77 libhandy
78 gjs
79 ];
80 postFixup = ''
81 patchShebangs "$out/share/gnome-shell/extensions/ddterm@amezin.github.com/bin/com.github.amezin.ddterm"
82 wrapGApp "$out/share/gnome-shell/extensions/ddterm@amezin.github.com/bin/com.github.amezin.ddterm"
83 '';
84 }))
85
86 (patchExtension "display-brightness-ddcutil@themightydeity.github.com" (old: {
87 # Make glib-compile-schemas available
88 nativeBuildInputs = [ glib ];
89 # Has a hard-coded path to a run-time dependency
90 # https://github.com/NixOS/nixpkgs/issues/136111
91 postPatch = ''
92 substituteInPlace "schemas/org.gnome.shell.extensions.display-brightness-ddcutil.gschema.xml" \
93 --replace-fail "/usr/bin/ddcutil" ${lib.getExe ddcutil}
94 '';
95 postFixup = ''
96 rm "$out/share/gnome-shell/extensions/display-brightness-ddcutil@themightydeity.github.com/schemas/gschemas.compiled"
97 glib-compile-schemas "$out/share/gnome-shell/extensions/display-brightness-ddcutil@themightydeity.github.com/schemas"
98 '';
99 }))
100
101 (patchExtension "eepresetselector@ulville.github.io" (old: {
102 patches = [
103 # Needed to find the currently set preset
104 (replaceVars ./extensionOverridesPatches/eepresetselector_at_ulville.github.io.patch {
105 easyeffects_gsettings_path = "${glib.getSchemaPath easyeffects}";
106 })
107 ];
108 }))
109
110 (patchExtension "freon@UshakovVasilii_Github.yahoo.com" (old: {
111 patches = [
112 (replaceVars ./extensionOverridesPatches/freon_at_UshakovVasilii_Github.yahoo.com.patch {
113 inherit
114 hddtemp
115 liquidctl
116 lm_sensors
117 procps
118 smartmontools
119 ;
120 netcat = netcat-gnu;
121 nvmecli = nvme-cli;
122 })
123 ];
124 }))
125
126 (patchExtension "gnome-shell-screenshot@ttll.de" (old: {
127 # Requires gjs
128 # https://github.com/NixOS/nixpkgs/issues/136112
129 postPatch = ''
130 for file in *.js; do
131 substituteInPlace $file --replace "gjs" "${gjs}/bin/gjs"
132 done
133 '';
134 }))
135
136 (patchExtension "gtk4-ding@smedius.gitlab.com" (old: {
137 nativeBuildInputs = [ wrapGAppsHook3 ];
138 patches = [
139 (replaceVars ./extensionOverridesPatches/gtk4-ding_at_smedius.gitlab.com.patch {
140 inherit gjs;
141 util_linux = util-linux;
142 xdg_utils = xdg-utils;
143 gtk_update_icon_cache = "${gtk4.out}/bin/gtk4-update-icon-cache";
144 update_desktop_database = "${desktop-file-utils.out}/bin/update-desktop-database";
145 nautilus_gsettings_path = glib.getSchemaPath nautilus;
146 })
147 ];
148 }))
149
150 (patchExtension "lunarcal@ailin.nemui" (
151 old:
152 let
153 chinese-calendar = stdenvNoCC.mkDerivation (finalAttrs: {
154 pname = "chinese-calendar";
155 version = "20240107";
156 nativeBuildInputs = [
157 cpio # used in install.sh
158 ];
159 src = fetchFromGitLab {
160 domain = "gitlab.gnome.org";
161 owner = "Nei";
162 repo = "ChineseCalendar";
163 tag = finalAttrs.version;
164 hash = "sha256-z8Af9e70bn3ztUZteIEt/b3nJIFosbnoy8mwKMM6Dmc=";
165 };
166 installPhase = ''
167 runHook preInstall
168 HOME=$out ./install.sh
169 runHook postInstall
170 '';
171 });
172 in
173 {
174 patches = [
175 (replaceVars ./extensionOverridesPatches/lunarcal_at_ailin.nemui.patch {
176 chinese_calendar_path = chinese-calendar;
177 })
178 ];
179 }
180 ))
181
182 (patchExtension "system-monitor@gnome-shell-extensions.gcampax.github.com" (old: {
183 patches = [
184 (replaceVars
185 ./extensionOverridesPatches/system-monitor_at_gnome-shell-extensions.gcampax.github.com.patch
186 {
187 gtop_path = "${libgtop}/lib/girepository-1.0";
188 }
189 )
190 ];
191 }))
192
193 (patchExtension "system-monitor-next@paradoxxx.zero.gmail.com" (old: {
194 patches = [
195 (replaceVars ./extensionOverridesPatches/system-monitor-next_at_paradoxxx.zero.gmail.com.patch {
196 gtop_path = "${libgtop}/lib/girepository-1.0";
197 })
198 ];
199 meta.maintainers = with lib.maintainers; [ andersk ];
200 }))
201
202 (patchExtension "Vitals@CoreCoding.com" (old: {
203 patches = [
204 (replaceVars ./extensionOverridesPatches/vitals_at_corecoding.com.patch {
205 gtop_path = "${libgtop}/lib/girepository-1.0";
206 })
207 ];
208 }))
209
210 (patchExtension "x11gestures@joseexposito.github.io" (old: {
211 # Extension can't find Touchegg
212 # https://github.com/NixOS/nixpkgs/issues/137621
213 postPatch = ''
214 substituteInPlace "src/touchegg/ToucheggConfig.js" \
215 --replace "GLib.build_filenamev([GLib.DIR_SEPARATOR_S, 'usr', 'share', 'touchegg', 'touchegg.conf'])" "'${touchegg}/share/touchegg/touchegg.conf'"
216 '';
217 }))
218
219 (patchExtension "pwcalc@thilomaurer.de" {
220 postPatch = ''
221 # remove unused dangling symlink
222 rm settings-importexport.ui
223 '';
224 })
225
226 (patchExtension "TeaTimer@zener.sbg.at" {
227 postPatch = ''
228 # remove unused dangling symlink
229 rm utilities-teatime.svg
230 '';
231 })
232]