1 { pkgs, lib, stdenv, fetchzip, nixosTests }:
5 buildGnomeExtension = {
6 # Every gnome extension has a UUID. It's the name of the extension folder once unpacked
7 # and can always be found in the metadata.json of every extension.
12 # extensions.gnome.org extension URL
14 # Extension version numbers are integers
17 # Hex-encoded string of JSON bytes
22 pname = "gnome-shell-extension-${pname}";
23 version = builtins.toString version;
25 url = "https://extensions.gnome.org/extension-data/${
26 builtins.replaceStrings [ "@" ] [ "" ] uuid
27 }.v${builtins.toString version}.shell-extension.zip";
30 # The download URL may change content over time. This is because the
31 # metadata.json is automatically generated, and parts of it can be changed
32 # without making a new release. We simply substitute the possibly changed fields
33 # with their content from when we last updated, and thus get a deterministic output
36 echo "${metadata}" | base64 --decode > $out/metadata.json
39 nativeBuildInputs = with pkgs; [ buildPackages.glib ];
42 if [ -d schemas ]; then
43 glib-compile-schemas --strict schemas
49 mkdir -p $out/share/gnome-shell/extensions/
50 cp -r -T . $out/share/gnome-shell/extensions/${uuid}
54 description = builtins.head (lib.splitString "\n" description);
55 longDescription = description;
57 license = lib.licenses.gpl2Plus; # https://gjs.guide/extensions/review-guidelines/review-guidelines.html#licensing
58 platforms = lib.platforms.linux;
59 maintainers = [ lib.maintainers.honnip ];
62 extensionPortalSlug = pname;
63 # Store the extension's UUID, because we might need it at some places
67 gnome-extensions = nixosTests.gnome-extensions;
72 lib.makeOverridable buildGnomeExtension