Migration This is my new public git source viewer. Source coming soon. Please contact with concerns/bugs. Contact me

users/ryan/modules/zen/default.nix

b7d807c39733ce101c55286d6428c19fb31c1ef3 · 2.8 KB · 94 lines raw

1 { config, lib, pkgs, ... }:
2 let
3 inherit (lib) mkOption mkEnableOption types mkIf mkMerge;
4 inherit (pkgs.stdenv.hostPlatform) isDarwin;
5 cfg = config.ryan.zen;
6
7 extensionType = types.submodule {
8 options = {
9 enable = mkOption {
10 type = types.bool;
11 default = true;
12 description = "Set false to drop an entry defined elsewhere (attrsOf can't delete keys).";
13 };
14 id = mkOption {
15 type = types.str;
16 description = "Add-on GUID; also the policy key and the AMO API lookup key.";
17 };
18 version = mkOption {
19 type = types.nullOr types.str;
20 default = null;
21 description = "Hard pin. null = whatever extensions.lock.json holds (bump with lock.sh).";
22 };
23 mode = mkOption {
24 type = types.enum [ "force_installed" "normal_installed" ];
25 default = "force_installed";
26 };
27 privateBrowsing = mkOption {
28 type = types.nullOr types.bool;
29 default = null;
30 description = "Emit private_browsing only when non-null.";
31 };
32 extraSettings = mkOption {
33 type = types.attrsOf types.anything;
34 default = { };
35 description = "Merged last into the ExtensionSettings entry (e.g. default_area).";
36 };
37 };
38 };
39 in
40 {
41 imports = [ ./extensions.nix ];
42
43 options.ryan.zen = {
44 enable = mkEnableOption "Zen browser with locked policies, profile and extensions";
45
46 extensions = mkOption {
47 type = types.attrsOf extensionType;
48 default = { };
49 description = "Policy-managed extensions, resolved through extensions.lock.json.";
50 };
51
52 exclusive = mkOption {
53 type = types.bool;
54 default = true;
55 description = "Disallow all undeclared extensions and disable all temporary loading";
56 };
57 };
58
59 config = mkIf cfg.enable (mkMerge [
60 {
61 programs.zen-browser = {
62 enable = true;
63 policies = import ./policies.nix;
64 profiles.default = import ./profile.nix;
65 };
66
67 ryan.zen.extensions = {
68 ublock-origin = {
69 id = "uBlock0@raymondhill.net";
70 privateBrowsing = true;
71 };
72 bitwarden = {
73 id = "{446900e4-71c2-419f-a6a7-df9c091e268b}";
74 mode = "normal_installed";
75 privateBrowsing = true;
76 };
77 sponsorblock.id = "sponsorBlocker@ajay.app";
78 dearrow.id = "deArrow@ajay.app";
79 return-youtube-dislikes.id = "{762f9885-5a13-4abd-9c77-433dcd38b8fd}";
80 youtube-nonstop.id = "{0d7cafdd-501c-49ca-8ebb-e3341caaa55e}";
81 tampermonkey.id = "firefox@tampermonkey.net";
82 floccus.id = "floccus@handmadeideas.org";
83 mailvelope.id = "jid1-AQqSMBYb0a8ADg@jetpack";
84 };
85 }
86
87 (mkIf isDarwin {
88 programs.zen-browser = {
89 package = null; # managed via homebrew
90 darwinDefaultsId = "app.zen-browser.zen";
91 };
92 })
93 ]);
94 }