aboutsummaryrefslogtreecommitdiffstats
path: root/hm/soispha/conf/firefox/default.nix
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2023-10-21 22:30:59 +0200
committerSoispha <soispha@vhack.eu>2023-10-21 22:30:59 +0200
commit27a254a27df47cac88ce8053b4efe575cf9c481e (patch)
tree5441124451062b275592bf798e9da88f10851f26 /hm/soispha/conf/firefox/default.nix
parentfix(hm/conf/firefox/scr/extensions): Add required 'default_area' (diff)
downloadnixos-config-27a254a27df47cac88ce8053b4efe575cf9c481e.zip
feat(hm/conf/firefox): Use the policy.json file for configs
Diffstat (limited to '')
-rw-r--r--hm/soispha/conf/firefox/default.nix141
1 files changed, 83 insertions, 58 deletions
diff --git a/hm/soispha/conf/firefox/default.nix b/hm/soispha/conf/firefox/default.nix
index d35b7256..7ebcbbb4 100644
--- a/hm/soispha/conf/firefox/default.nix
+++ b/hm/soispha/conf/firefox/default.nix
@@ -6,88 +6,113 @@
video_pause,
...
}: let
+ extensions =
+ builtins.fromJSON (builtins.readFile
+ ./config/extensions/extensions.json);
+
userChrome = builtins.readFile ./config/chrome/userChrome.css;
+ bookmarks = (import ./config/bookmarks/default.nix) {
+ inherit
+ pkgs
+ lib
+ ;
+ };
+ engines = (import ./config/search/engines) {inherit pkgs;};
- user_js_nix = (import ./config/prefs) {inherit pkgs lib config user_js;};
+ native_messaging_hosts = (import ./config/extensions/native_messaging_hosts) {inherit pkgs video_pause;};
- extensions = builtins.map buildFirefoxXpiAddon (
- lib.attrValues (
- lib.importJSON ./config/extensions/extensions.json
- )
- );
- engines = (import ./config/search/engines) {inherit pkgs;};
+ policies = (import ./config/policies) {inherit config extensions;};
+
+ search = {
+ default = "Brave Search";
+ force = true;
- # source: https://gitlab.com/rycee/nur-expressions/-/blob/master/pkgs/firefox-addons/default.nix
- buildFirefoxXpiAddon = (import ./functions/extensions) {inherit pkgs;};
+ inherit engines;
+ };
- video-pauser = (import ./functions/extensions/video-pauser.nix) {inherit pkgs video_pause;};
+ prefConfig = builtins.readFile "${
+ (import ./config/prefs) {inherit pkgs lib config bookmarks user_js;}
+ }/user.js";
+ # Package {{{
+ package = import ./package.nix {
+ inherit config lib pkgs;
+ extraPolicies = policies;
+ extraNativeMessagingHosts = native_messaging_hosts;
+ };
+ # }}}
+
+ # Profiles {{{
profiles = {
"default" = {
- inherit extensions search extraConfig bookmarks userChrome;
+ inherit search userChrome;
isDefault = true;
id = 0;
name = "default";
- };
- "clean" = {
- isDefault = false;
- id = 1;
- name = "clean";
+ extraConfig = prefConfig;
};
};
taskwarriorProfiles = import ../taskwarrior/firefox {
inherit
- extensions
- userChrome
- extraConfig
- bookmarks
- search
- lib
config
+ lib
+ # options
+
+ prefConfig
+ search
+ userChrome
;
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"];
+ options.soispha.firefox = {
+ package = lib.mkOption {
+ type = lib.types.package;
+ default = pkgs.firefox;
+ description = "Firefox package to use.";
+ defaultText = lib.literalExpression "pkgs.firefox";
+ relatedPackages = [
+ "firefox"
+ "firefox-beta-bin"
+ "firefox-bin"
+ "firefox-devedition-bin"
+ "firefox-esr"
+ ];
+ };
+ package_version = lib.mkOption {
+ type = lib.types.str;
+ default = pkgs.firefox.version;
+ description = "Firefox version to use";
};
};
- programs.firefox = {
- enable = true;
- package = pkgs.firefox-wayland.override {
- extraNativeMessagingHosts = [video-pauser];
- cfg = {
- enableTridactylNative = true;
+
+ config = {
+ soispha.firefox.package = package;
+ soispha.firefox.package_version = pkgs.firefox.version;
+ 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"];
};
};
- profiles =
- profiles
- // taskwarriorProfiles;
+ programs.firefox = {
+ enable = true;
+ inherit (config.soispha.firefox) package;
+ profiles =
+ profiles
+ // taskwarriorProfiles;
+ };
};
}