split custom search-engine configuration into seperate file

This commit is contained in:
xunuwu 2024-09-13 16:22:47 +02:00
parent f0430a5815
commit 9a1ab7e65a
Signed by: xun
SSH key fingerprint: SHA256:Uot/1WoAjWAeqLOHA5vYy4phhVydsH7jCPmBjaPZfgI
2 changed files with 104 additions and 97 deletions

View file

@ -1,10 +1,12 @@
{
inputs,
pkgs,
lib,
config,
...
}: {
imports = [
./search-engines.nix
];
xdg.configFile."tridactyl/tridactylrc" = {
text = ''
unbind <C-e>
@ -46,102 +48,6 @@
meta = {};
})
];
bookmarks = {};
search = {
force = true;
default = "Brave";
order = [
"Brave"
"Google"
"DuckDuckGo"
];
engines = let
inherit (lib.attrsets) attrsToList;
inherit (lib.lists) singleton;
in {
"Home Manager" = {
urls = singleton {
template = "https://home-manager-options.extranix.com";
params = attrsToList {
query = "{searchTerms}";
release = "master";
};
};
iconUpdateURL = "https://home-manager-options.extranix.com/images/favicon.png";
definedAliases = ["@hm"];
};
"Nix Packages" = {
urls = singleton {
template = "https://search.nixos.org/packages";
params = attrsToList {
query = "{searchTerms}";
channel = "unstable";
};
};
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@np"];
};
"NixOS Options" = {
urls = singleton {
template = "https://search.nixos.org/options";
params = attrsToList {
query = "{searchTerms}";
channel = "unstable";
};
};
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@no"];
};
"GitHub" = {
urls = singleton {
template = "https://github.com/search";
params = attrsToList {
q = "{searchTerms}";
type = "code";
};
};
iconUpdateURL = "https://github.githubassets.com/favicons/favicon-dark.svg";
definedAliases = ["@gh"];
};
"GitHub Repos" = {
urls = singleton {
template = "https://github.com/search";
params = attrsToList {
q = "{searchTerms}";
type = "repositories";
};
};
iconUpdateURL = "https://github.githubassets.com/favicons/favicon-dark.svg";
definedAliases = ["@ghr"];
};
"GitHub Nix" = {
urls = singleton {
template = "https://github.com/search";
params = attrsToList {
"q" = "lang:nix {searchTerms}";
"type" = "code";
};
};
iconUpdateURL = "https://github.githubassets.com/favicons/favicon-dark.svg";
definedAliases = ["@ghn"];
};
"Brave" = {
urls = singleton {
template = "https://search.brave.com/search";
params = attrsToList {
"q" = "{searchTerms}";
};
};
iconUpdateURL = "https://brave.com/static-assets/images/brave-favicon.png";
definedAliases = ["@b"];
};
"Google".metaData.alias = "@go";
"DuckDuckGo".metaData.alias = "@ddg";
"Wikipedia".metaData.alias = "@wiki";
"Bing".metaData.hidden = true;
};
};
userChrome = builtins.readFile ./userChrome.css;
settings = {
"browser.display.use_system_colors" = true; # about:blank colour match colourscheme

View file

@ -0,0 +1,101 @@
{
lib,
pkgs,
...
}: {
programs.firefox.profiles.xun.search = let
inherit (lib) attrsToList singleton;
in {
force = true;
default = "Brave";
order = [
"Brave"
"Google"
"DuckDuckGo"
];
engines = {
"Home Manager" = {
urls = singleton {
template = "https://home-manager-options.extranix.com";
params = attrsToList {
query = "{searchTerms}";
release = "master";
};
};
iconUpdateURL = "https://home-manager-options.extranix.com/images/favicon.png";
definedAliases = ["@hm"];
};
"Nix Packages" = {
urls = singleton {
template = "https://search.nixos.org/packages";
params = attrsToList {
query = "{searchTerms}";
channel = "unstable";
};
};
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@np"];
};
"NixOS Options" = {
urls = singleton {
template = "https://search.nixos.org/options";
params = attrsToList {
query = "{searchTerms}";
channel = "unstable";
};
};
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@no"];
};
"GitHub" = {
urls = singleton {
template = "https://github.com/search";
params = attrsToList {
q = "{searchTerms}";
type = "code";
};
};
iconUpdateURL = "https://github.githubassets.com/favicons/favicon-dark.svg";
definedAliases = ["@gh"];
};
"GitHub Repos" = {
urls = singleton {
template = "https://github.com/search";
params = attrsToList {
q = "{searchTerms}";
type = "repositories";
};
};
iconUpdateURL = "https://github.githubassets.com/favicons/favicon-dark.svg";
definedAliases = ["@ghr"];
};
"GitHub Nix" = {
urls = singleton {
template = "https://github.com/search";
params = attrsToList {
"q" = "lang:nix {searchTerms}";
"type" = "code";
};
};
iconUpdateURL = "https://github.githubassets.com/favicons/favicon-dark.svg";
definedAliases = ["@ghn"];
};
"Brave" = {
urls = singleton {
template = "https://search.brave.com/search";
params = attrsToList {
"q" = "{searchTerms}";
};
};
iconUpdateURL = "https://brave.com/static-assets/images/brave-favicon.png";
definedAliases = ["@b"];
};
"Google".metaData.alias = "@go";
"DuckDuckGo".metaData.alias = "@ddg";
"Wikipedia".metaData.alias = "@wiki";
"Bing".metaData.hidden = true;
};
};
}