1{
2 lib,
3 callPackage,
4 config,
5}:
6let
7 buildShellExtension = callPackage ./buildGnomeExtension.nix { };
8
9 # Index of all scraped extensions (with supported versions)
10 extensionsIndex = lib.importJSON ./extensions.json;
11
12 # A list of UUIDs that have the same pname and we need to rename them
13 extensionRenames = import ./extensionRenames.nix;
14
15 # Take all extensions from the index that match the gnome version, build them and put them into a list of derivations
16 produceExtensionsList =
17 shell-version:
18 lib.trivial.pipe extensionsIndex [
19 # Does a given extension match our current shell version?
20 (builtins.filter (extension: (builtins.hasAttr shell-version extension."shell_version_map")))
21 # Take in an `extension` object from the JSON and transform it into the correct args to call `buildShellExtension`
22 (map (extension: {
23 inherit (extension)
24 uuid
25 name
26 description
27 link
28 pname
29 ;
30 inherit (extension.shell_version_map.${shell-version}) version sha256 metadata;
31 }))
32 # Build them
33 (map buildShellExtension)
34 ];
35
36 # Map the list of extensions to an attrset based on the UUID as key
37 mapUuidNames =
38 extensions:
39 lib.trivial.pipe extensions [
40 (map (extension: lib.nameValuePair extension.extensionUuid extension))
41 builtins.listToAttrs
42 ];
43
44 # Map the list of extensions to an attrset based on the pname as key, which is more human readable than the UUID
45 # We also take care of conflict renaming in here
46 mapReadableNames =
47 extensionsList:
48 lib.trivial.pipe extensionsList [
49 # Filter out all extensions that map to null
50 (lib.filter (
51 extension:
52 !(
53 (builtins.hasAttr extension.extensionUuid extensionRenames)
54 && ((builtins.getAttr extension.extensionUuid extensionRenames) == null)
55 )
56 ))
57 # Map all extensions to their pname, with potential overwrites
58 (map (
59 extension:
60 lib.nameValuePair (extensionRenames.${extension.extensionUuid} or extension.extensionPortalSlug
61 ) extension
62 ))
63 builtins.listToAttrs
64 ];
65
66in
67rec {
68 # Remember to import all these in all-packages.nix
69 gnome38Extensions = mapUuidNames (produceExtensionsList "38");
70 gnome40Extensions = mapUuidNames (produceExtensionsList "40");
71 gnome41Extensions = mapUuidNames (produceExtensionsList "41");
72 gnome42Extensions = mapUuidNames (produceExtensionsList "42");
73 gnome43Extensions = mapUuidNames (produceExtensionsList "43");
74 gnome44Extensions = mapUuidNames (produceExtensionsList "44");
75 gnome45Extensions = mapUuidNames (produceExtensionsList "45");
76 gnome46Extensions = mapUuidNames (produceExtensionsList "46");
77 gnome47Extensions = mapUuidNames (produceExtensionsList "47");
78 gnome48Extensions = mapUuidNames (produceExtensionsList "48");
79
80 # Keep the last three versions in here
81 gnomeExtensions = lib.trivial.pipe (gnome46Extensions // gnome47Extensions // gnome48Extensions) [
82 # Apply some custom patches for automatically packaged extensions
83 (callPackage ./extensionOverrides.nix { })
84 # Add all manually packaged extensions
85 (extensions: extensions // (import ./manuallyPackaged.nix { inherit callPackage; }))
86 # Map the extension UUIDs to readable names
87 (lib.attrValues)
88 (mapReadableNames)
89 # Add some aliases
90 (
91 extensions:
92 extensions
93 // lib.optionalAttrs config.allowAliases {
94 unite-shell = gnomeExtensions.unite; # added 2021-01-19
95 arc-menu = gnomeExtensions.arcmenu; # added 2021-02-14
96
97 icon-hider = throw "gnomeExtensions.icon-hider was removed on 2024-03-15. The extension has not received any updates since 2020/3.34.";
98 nohotcorner = throw "gnomeExtensions.nohotcorner removed since 2019-10-09: Since 3.34, it is a part of GNOME Shell configurable through GNOME Tweaks.";
99 mediaplayer = throw "gnomeExtensions.mediaplayer deprecated since 2019-09-23: retired upstream https://github.com/JasonLG1979/gnome-shell-extensions-mediaplayer/blob/master/README.md";
100 remove-dropdown-arrows = throw "gnomeExtensions.remove-dropdown-arrows removed since 2021-05-25: The extensions has not seen an update sine GNOME 3.34. Furthermore, the functionality it provides is obsolete as of GNOME 40.";
101 }
102 )
103 # Export buildShellExtension function
104 (extensions: extensions // { inherit buildShellExtension; })
105 # Make the set "public"
106 lib.recurseIntoAttrs
107 ];
108
109}