summaryrefslogtreecommitdiff
path: root/modules/home-manager/personal/programs
diff options
context:
space:
mode:
authorquentin@aristote.fr <quentin@aristote.fr>2023-03-04 18:08:55 +0100
committerquentin@aristote.fr <quentin@aristote.fr>2023-03-04 18:08:55 +0100
commitd1b575c1248879ddc477da16544d6727f928c472 (patch)
treef25d0af0c1e686c980d19eacaf730e7f4e0ca0c0 /modules/home-manager/personal/programs
parent507097cba89eaf6824d815f6432cb337e56a3507 (diff)
home: firefox: add search engines
Diffstat (limited to 'modules/home-manager/personal/programs')
-rw-r--r--modules/home-manager/personal/programs/firefox/default.nix80
-rw-r--r--modules/home-manager/personal/programs/firefox/engines.nix121
2 files changed, 168 insertions, 33 deletions
diff --git a/modules/home-manager/personal/programs/firefox/default.nix b/modules/home-manager/personal/programs/firefox/default.nix
index f4696b1..6b7cfee 100644
--- a/modules/home-manager/personal/programs/firefox/default.nix
+++ b/modules/home-manager/personal/programs/firefox/default.nix
@@ -7,7 +7,7 @@ let
inherit (pkgs.personal.static.userjs) arkenfox;
inherit (pkgs.lib.personal) toUserJS;
};
- engines = import ./engines.nix;
+ engines = import ./engines.nix { inherit lib pkgs; };
userchrome-treestyletabs = ''
/* Hide main tabs toolbar */
#TabsToolbar {
@@ -23,19 +23,6 @@ let
visibility: collapse;
}
'';
- extensions = with pkgs.personal.firefoxAddons; [
- canvasblocker
- clearurls
- darkreader
- neat-url
- redirector
- smart-referer
- temporary-containers
- tree-style-tab
- ublock-origin
- unpaywall
- url-in-title
- ];
webappsWithIds = (builtins.foldl' ({ counter, value }:
{ name, ... }@next: {
counter = counter + 1;
@@ -75,34 +62,75 @@ in {
{ name, id, profileName, extraUserJS, ... }:
prev // {
"${profileName}" = {
- inherit extensions;
id = id + 2;
+ extensions = with pkgs.personal.firefoxAddons; [
+ clearurls
+ neat-url
+ redirector
+ smart-referer
+ ublock-origin
+ unpaywall
+ url-in-title
+ ];
+ search = {
+ force = true;
+ engines = with engines; disableDefault // { inherit Searx; };
+ default = "Searx";
+ };
extraConfig = userjs.streaming + extraUserJS;
};
}) {
default = {
- inherit extensions;
id = 0; # isDefault = true
- extraConfig = userjs.default;
- userChrome = userchrome-treestyletabs;
+ extensions = with pkgs.personal.firefoxAddons; [
+ canvasblocker
+ clearurls
+ darkreader
+ neat-url
+ redirector
+ smart-referer
+ temporary-containers
+ tree-style-tab
+ ublock-origin
+ unpaywall
+ url-in-title
+ ];
search = {
force = lib.mkDefault true;
- engines = {
- inherit (engines) Searx;
- "Bing".metaData.hidden = true;
- "Google".metaData.hidden = true;
- "Amazon.fr".metaData.hidden = true;
- };
+ engines = with engines;
+ disableDefault // {
+ inherit Searx;
+ } // lib.optionalAttrs config.personal.identities.personal
+ personal
+ // lib.optionalAttrs config.personal.identities.work work
+ // lib.optionalAttrs config.personal.profiles.dev dev;
default = "Searx";
order = [ "Searx" "Wikipedia" ];
};
+ extraConfig = userjs.default;
+ userChrome = userchrome-treestyletabs;
};
videoconferencing = {
- inherit extensions;
id = 1;
-
+ extensions = with pkgs.personal.firefoxAddons; [
+ clearurls
+ darkreader
+ neat-url
+ redirector
+ smart-referer
+ multi-account-containers
+ tree-style-tab
+ ublock-origin
+ unpaywall
+ url-in-title
+ ];
+ search = {
+ force = true;
+ engines = with engines; disableDefault // { inherit Searx; };
+ default = "Searx";
+ };
extraConfig = userjs.videoconferencing;
userChrome = userchrome-treestyletabs;
};
diff --git a/modules/home-manager/personal/programs/firefox/engines.nix b/modules/home-manager/personal/programs/firefox/engines.nix
index 7ea2830..e04cc2e 100644
--- a/modules/home-manager/personal/programs/firefox/engines.nix
+++ b/modules/home-manager/personal/programs/firefox/engines.nix
@@ -1,8 +1,115 @@
-{
- Searx = {
- urls = [{ template = "https://searx.aristote.fr/search?q={searchTerms}"; }];
- iconUpdateURL =
- "https://searx.aristote.fr/static/themes/oscar/img/favicon.png";
- updateInterval = 24 * 60 * 60 * 1000; # every day
+{ lib, pkgs }:
+
+let
+ everyday = 24 * 60 * 60 * 1000;
+ self = {
+ disable = engines: lib.genAttrs engines (name: { metadata.hidden = true; });
+ disableDefault = self.disable [ "Google" "Amazon.fr" "Bing" ];
+
+ nix = {
+ inherit (self) "Home Manager Options" "NixOS Options" "NixOS Wiki" "Nix Packages";
+ };
+ dev = self.nix // { inherit (self) AlternativeTo; };
+ personal = { inherit (self) Emojipedia; };
+ work = { inherit (self) nLab; };
+ all = self.dev // self.personal // self.work // { inherit (self) Searx; };
+
+ Emojipedia = {
+ urls = [{
+ template = "https://emojipedia.org/search/?";
+ parameters = [ (lib.nameValuePair "q" "{searchTerms}") ];
+ }];
+
+ iconUpdateURL =
+ "https://emojipedia.org/static/img/favicons/favicon-16x16.png";
+ updateInterval = everyday;
+
+ definedAliases = [ "@emojipedia" "@emoji" "@em" ];
+ };
+
+ AlternativeTo = {
+ urls = [{
+ template = "https://alternativeto.net/browse/search/?";
+ parameters = [ (lib.nameValuePair "q" "{searchTerms}") ];
+ }];
+
+ iconUpdateURL =
+ "https://alternativeto.net/static/icons/a2/favicon-16x16.png";
+ updateInterval = everyday;
+
+ definedAliases = [ "@alternativeto" "@a2" ];
+ };
+
+ "Home Manager Options" = {
+ urls = [{
+ template =
+ "https://mipmip.github.io/home-manager-option-search/?{searchTerms}";
+ }];
+
+ icon =
+ "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
+
+ definedAliases = [ "@homemanager" "@hm" ];
+ };
+
+ "NixOS Options" = {
+ urls = [{
+ template = "https://search.nixos.org/options";
+ parameters = [
+ (lib.nameValuePair "channel" "unstable")
+ (lib.nameValuePair "query" "{searchTerms}")
+ ];
+
+ icon =
+ "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
+ definedAliases = [ "@nixos" "@no" ];
+ }];
+ };
+
+ "NixOS Wiki" = {
+ urls = [{
+ template = "https://nixos.wiki/index.php?";
+ parameters = [ (lib.nameValuePair "search" "{searchTerms}") ];
+ }];
+ iconUpdateURL = "https://nixos.wiki/favicon.png";
+ updateInterval = everyday;
+ definedAliases = [ "@nixoswiki" "@nw" ];
+ };
+
+ "Nix Packages" = {
+ urls = [{
+ template = "https://search.nixos.org/packages";
+ parameters = [
+ (lib.nameValuePair "channel" "unstable")
+ (lib.nameValuePair "query" "{searchTerms}")
+ ];
+
+ icon =
+ "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
+ definedAliases = [ "@nixpkgs" "@np" ];
+ }];
+ };
+
+ nLab = {
+ urls = {
+ template = "https://ncatlab.org/nlab/search?";
+ parameters = [ (lib.nameValuePair "query" "{searchTerms}") ];
+ };
+
+ iconUpdateURL = "https://ncatlab.org/favicon.ico";
+ updateInterval = everyday;
+
+ definedAliases = [ "@ncatlab" "@nlab" ];
+ };
+
+ Searx = {
+ urls = [{
+ template = "https://searx.aristote.fr/search?";
+ parameters = [ (lib.nameValuePair "q" "{searchTerms}") ];
+ }];
+ iconUpdateURL =
+ "https://searx.aristote.fr/static/themes/oscar/img/favicon.png";
+ updateInterval = everyday;
+ };
};
-}
+in self