aboutsummaryrefslogtreecommitdiff
path: root/share/cfg/firefox/default.nix
blob: 07281ec54cfaa70b98951895e269bc68d0c82201 (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
{ pkgs, ... }:
let
  # Concatenate all files in the `./usercss` directory into one string
  css-files =
    map (n: ./usercss/${n}) (builtins.attrNames (builtins.readDir ./usercss));
  userChrome = builtins.concatStringsSep "\n" (map builtins.readFile css-files);
in
{
  home.sessionVariables.BROWSER = "firefox";

  programs.firefox = {
    profiles = {
      alice = {
        name = "alice";
        isDefault = true;
        inherit userChrome;

        search = {
          default = "DuckDuckGo";
          engines = {
            "Nix Packages" = {
              urls = [{
                template = "https://search.nixos.org/packages";
                params = [
                  {
                    name = "type";
                    value = "packages";
                  }
                  {
                    name = "query";
                    value = "{searchTerms}";
                  }
                ];
              }];

              icon =
                "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
              definedAliases = [ "@np" ];
            };

            "NixOS Wiki" = {
              urls = [{
                template = "https://nixos.wiki/index.php?search={searchTerms}";
              }];
              iconUpdateURL = "https://nixos.wiki/favicon.png";
              updateInterval = 24 * 60 * 60 * 1000; # every day
              definedAliases = [ "@nw" ];
            };

            "Bing".metaData.hidden = true;
            # builtin engines only support specifying one additional alias
            "Google".medaData.alias = "@g";
          };
        }; # end of search

        settings = {
          "browser.compactmode.show" = true;
          "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
        };
      }; # end of alice (profile)
    }; # end of profiles
  };
}