about summary refs log tree commit diff stats
path: root/hm/soispha/conf/firefox/default.nix
blob: d35b72566d8a633c2499e271e5adae1a1416f599 (plain) (blame)
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
{
  config,
  pkgs,
  lib,
  user_js,
  video_pause,
  ...
}: let
  userChrome = builtins.readFile ./config/chrome/userChrome.css;

  user_js_nix = (import ./config/prefs) {inherit pkgs lib config user_js;};

  extensions = builtins.map buildFirefoxXpiAddon (
    lib.attrValues (
      lib.importJSON ./config/extensions/extensions.json
    )
  );
  engines = (import ./config/search/engines) {inherit pkgs;};

  # source: https://gitlab.com/rycee/nur-expressions/-/blob/master/pkgs/firefox-addons/default.nix
  buildFirefoxXpiAddon = (import ./functions/extensions) {inherit pkgs;};

  video-pauser = (import ./functions/extensions/video-pauser.nix) {inherit pkgs video_pause;};

  profiles = {
    "default" = {
      inherit extensions search extraConfig bookmarks userChrome;
      isDefault = true;
      id = 0;
      name = "default";
    };
    "clean" = {
      isDefault = false;
      id = 1;
      name = "clean";
    };
  };

  taskwarriorProfiles = import ../taskwarrior/firefox {
    inherit
      extensions
      userChrome
      extraConfig
      bookmarks
      search
      lib
      config
      ;
    profile_size = builtins.length (builtins.attrNames profiles);
  };

  search = {
    default = "Brave Search";
    force = true;

    inherit engines;
  };

  bookmarks = [];
  extraConfig = builtins.readFile "${user_js_nix}/user.js";
in {
  home.packages = [
    pkgs.tridactyl-native
  ];
  home.sessionVariables = {
    # improve touch input & make scrolling smother
    MOZ_USE_XINPUT2 = "1";
    # improve wayland support
    MOZ_ENABLE_WAYLAND = 1;
  };
  xdg.mimeApps = {
    enable = true;
    defaultApplications = {
      "text/html" = ["firefox.desktop"];
      "x-scheme-handler/http" = ["firefox.desktop"];
      "x-scheme-handler/https" = ["firefox.desktop"];
      "x-scheme-handler/about" = ["firefox.desktop"];
      "x-scheme-handler/unknown" = ["firefox.desktop"];
    };
  };
  programs.firefox = {
    enable = true;
    package = pkgs.firefox-wayland.override {
      extraNativeMessagingHosts = [video-pauser];
      cfg = {
        enableTridactylNative = true;
      };
    };
    profiles =
      profiles
      // taskwarriorProfiles;
  };
}