aboutsummaryrefslogtreecommitdiff
path: root/home-manager/homeModules/firefox/default.nix
blob: 804e9c25eb2d4d0f0b7455b1dbf4a97dc91758e7 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{ pkgs, config, lib, inputs, ... }:

{
  options = {
    firefox.enable = lib.mkEnableOption "enable firefox";
  };
  config = lib.mkIf config.firefox.enable {
    programs.firefox = {
      enable = false;
      profiles.nothing = {
        isDefault = false;
        id = 1;
      };
      profiles.Betterfox = {
        isDefault = true;
        extensions =
          let
            nur = import inputs.nurpkgs.homeManagerModules.nurpkgs {
              inherit pkgs;
              nurpkgs = pkgs;
            };
          in
            with nur.repos.rycee.firefox-addons; [
              bitwarden
              ublock-origin
              switchyomega
              sponsorblock
              return-youtube-dislikes
              firefox-color
              tampermonkey
              duckduckgo-privacy-essentials
              sidebery
            ];

        extraConfig =
          let
            userConfig = builtins.readFile ./user.js;
            configOverrides = ''
                  user_pref("browser.search.suggest.enabled", true);
                  user_pref("mousewheel.default.delta_multiplier_y", 75); 
                  user_pref("network.captive-portal-service.enabled", true);
                  user_pref("captivedetect.canonicalURL", "http://detectportal.firefox.com/canonical.html");
                  user_pref("network.connectivity-service.enabled", true);
                '';
          in
            userConfig + configOverrides;
        search = {
          force = true;
          engines = {
            "Brave" = {
              urls = [{ template = "https://search.brave.com/search?q={searchTerms}"; }];
              iconUpdateURL = "https://cdn.search.brave.com/serp/v2/_app/immutable/assets/safari-pinned-tab.539899c7.svg";
              updateInterval = 24 * 60 * 60 * 1000;
              definedAliases = [ "!br" ];
            };
            "NixOS" = {
              urls = [{ template = "https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query={searchTerms}"; }];
              iconUpdateURL = "https://nixos.org/favicon.png";
              updateInterval = 24 * 60 * 60 * 1000;
              definedAliases = [ "!ns" ];
            };
            "HomeManager" = {
              urls = [{ template = "https://mipmip.github.io/home-manager-option-search/?query={searchTerms}"; }];
              iconUpdateURL = "https://github.com/mipmip/home-manager-option-search/blob/main/images/favicon.png";
              updateInterval = 24 * 60 * 60 * 1000;
              definedAliases = [ "!hs" ];
            };
            "ai question" = {
              urls = [{ template = "https://iask.ai/?mode=question&q={searchTerms}"; }];
              iconUpdateURL = "https://iask.ai/favicons/favicon-32x32-650bd8771fdea8866630408578e381cc.png?vsn=d";
              updateInterval = 24 * 60 * 60 * 1000;
              definedAliases = [ "!aq" ];
            };
            "ai forums" = {
              urls = [{ template = "https://iask.ai/?mode=forums&q={searchTerms}"; }];
              iconUpdateURL = "https://iask.ai/favicons/favicon-32x32-650bd8771fdea8866630408578e381cc.png?vsn=d";
              updateInterval = 24 * 60 * 60 * 1000;
              definedAliases = [ "!af" ];
            };
            "ai wiki" = {
              urls = [{ template = "https://iask.ai/?mode=wiki&q={searchTerms}"; }];
              iconUpdateURL = "https://iask.ai/favicons/favicon-32x32-650bd8771fdea8866630408578e381cc.png?vsn=d";
              updateInterval = 24 * 60 * 60 * 1000;
              definedAliases = [ "!aw" ];
            };
            "FastGPT" = {
              urls = [{ template = "https://labs.kagi.com/fastgpt?query={searchTerms}"; }];
              definedAliases = [ "!fq" ];
            };
            "NixWiki" = {
              urls = [{ template = "https://nixos.wiki/index.php?search={searchTerms}&go=Go"; }];
              iconUpdateURL = "https://nixos.org/favicon.png";
              updateInterval = 24 * 60 * 60 * 1000;
              definedAliases = [ "!nw" ];
            };
            "Kinopoisk" = {
              urls = [{ template = "https://www.kinopoisk.ru/index.php?kp_query={searchTerms}"; }];
              iconUpdateURL = "https://www.kinopoisk.ru/favicon.ico";
              updateInterval = 24 * 60 * 60 * 1000;
              definedAliases = [ "!ks" ];
            };
            "AnimeGo" = {
              urls = [{ template = "https://animego.org/search/all?q={searchTerms}"; }];
              iconUpdateURL = "https://animego.org/favicon-32x32.png";
              updateInterval = 24 * 60 * 60 * 1000;
              definedAliases = [ "!as" ];
            };
          };
          default = "Brave";
        };
      };
    };
    home.file."chrome" = {
      source = ./userChrome.css;
      target = ".mozilla/firefox/Betterfox/chrome/userChrome.css";
    };

  };
}