aboutsummaryrefslogtreecommitdiffstats
path: root/modules/web/chromium/extensions/default.nix
blob: 78c063060b3fa19621be498513b508383cec1a8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
  lib,
  pkgs,
  config,
  ...
}:
let
  cfg = config.web.chromium;

  extLib = import ./lib.nix {
    inherit lib pkgs config;
  };

  mkExtension = path: import path { inherit lib pkgs extLib; };

  extensionSubmodule = lib.types.submodule {
    options = {
      pname = lib.mkOption {
        type = lib.types.str;
        description = "Package name of the extension.";
      };
      version = lib.mkOption {
        type = lib.types.str;
        description = "Resolved/pinned version of the extension.";
      };
      id = lib.mkOption {
        type = lib.types.nullOr lib.types.str;
        description = "Chrome extension ID, derived from the pinned key. Null if the extension isn't key-pinned.";
      };
      drv = lib.mkOption {
        type = lib.types.package;
        description = "Unpacked extension derivation.";
      };
    };
  };
in
{
  imports = [
    ./assertions.nix
  ];

  options.web.chromium.extensions = lib.mkOption {
    type = lib.types.attrsOf extensionSubmodule;
    internal = true;
    default = { };
    description = ''
      Resolved chromium extension derivations, keyed by name. Computed
      internally from ./extensions/*.nix — not user-settable. Read from
      other modules via e.g. `config.web.chromium.extensions.browserpass.id`.
    '';
  };

  # Readonly options get their actual value assigned here in this module
  config.web.chromium.extensions = {
    aria2Explorer = mkExtension ./aria2-explorer.nix;
    browserpass = mkExtension ./browserpass.nix;
    darkreader = mkExtension ./darkreader.nix;
    searxngHome = mkExtension ./searxng-home.nix;
    theme = mkExtension ./theme.nix;
    ublockOrigin = mkExtension ./ublock-origin.nix;
    vimium = mkExtension ./vimium.nix;
  };
}