about summary refs log tree commit diff
path: root/home/profiles/browsing/default.nix
blob: 54a44fc7e05e7c8079ed3d36786324e38458ca84 (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
{ config, lib, pkgs, ... }:
let cfg = config.profiles.browsing;
in
{
  options.profiles.browsing = {
    enable = lib.mkEnableOption
      "A profile that enables a browser for the GUI and the terminal";
  };

  config = lib.mkIf cfg.enable {
    home.packages = with pkgs; [ lynx ] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) [
      # TODO: currently broken/doesn't support Darwin
      pkgs.firefox
    ];

    programs.qutebrowser = {
      enable = true;

      searchEngines = {
        DEFAULT = "https://searx.be/search?q={}";
        g = "https://www.google.com/search?hl=en&q={}";
        ddg = "https://www.duckduckgo.com/?q={}";
        nw = "https://nixos.wiki/index.php?search={}";
        ns = "https://search.nixos.org/options?channel=unstable&from=0size=50&sort=relevance&type=packages&query={}";
        np = "https://search.nixos.org/packages?channel=unstable&from=0&size=50&sort=relevance&type=packages&query={}";
        rd = "https://docs.rs/releases/search?query={}";
        rp = "https://lib.rs/search?q={}";
      };

      quickmarks = {
        github = "https://github.com";
        sourcehut = "https://sr.ht";
      };


      settings = import ./qutebrowser-settings.nix // {
        url.default_page = "https://searx.be";
        url.start_pages = "https://searx.be";
      };
    };

    xdg.mimeApps = lib.mkIf pkgs.stdenv.isLinux {
      enable = true;
      defaultApplications = {
          "x-scheme-handler/http" = [ "org.qutebrowser.qutebrowser.desktop" ];
          "x-scheme-handler/https" = [ "org.qutebrowser.qutebrowser.desktop" ];
          "text/html" = [ "org.qutebrowser.qutebrowser.desktop" ];
          "x-scheme-handler/about" = [ "org.qutebrowser.qutebrowser.desktop" ];
          "x-scheme-handler/unknown" = [ "org.qutebrowser.qutebrowser.desktop" ];
      };
    };
  };
}