This commit is contained in:
commit
95a533c876
451 changed files with 18255 additions and 0 deletions
88
modules/home/librewolf/search/default.nix
Normal file
88
modules/home/librewolf/search/default.nix
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.programs.librewolf;
|
||||
engines = import ./engines.nix pkgs;
|
||||
|
||||
urlRegex = "^(http|https|ftp)://";
|
||||
isUrl = s: (match urlRegex s) != null;
|
||||
|
||||
transformEngine =
|
||||
engine:
|
||||
let
|
||||
every_day = 24 * 60 * 60 * 1000;
|
||||
in
|
||||
{
|
||||
urls = [ { template = engine.url; } ];
|
||||
icon = engine.icon;
|
||||
updateInterval = if (isUrl engine.icon) then every_day else null;
|
||||
definedAliases = optional (engine ? alias) engine.alias;
|
||||
};
|
||||
|
||||
transformedEngines = mapAttrs' (name: engine: {
|
||||
name = name;
|
||||
value = transformEngine engine;
|
||||
}) engines;
|
||||
|
||||
inherit (lib)
|
||||
listToAttrs
|
||||
mapAttrs
|
||||
mapAttrs'
|
||||
mkOption
|
||||
optional
|
||||
types
|
||||
;
|
||||
inherit (lib.strings) match;
|
||||
in
|
||||
{
|
||||
options.programs.librewolf = {
|
||||
searchEngines = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [
|
||||
"github"
|
||||
"home-manager-options"
|
||||
"nixos-options"
|
||||
"nixos-wiki"
|
||||
"nixpkgs"
|
||||
"nixpkgs-issues"
|
||||
"noogle"
|
||||
"nuschtos"
|
||||
"wikiless"
|
||||
"youtube"
|
||||
];
|
||||
example = [
|
||||
"github"
|
||||
"home-manager-options"
|
||||
"howlongtobeat"
|
||||
"keyforsteam"
|
||||
"nixos-options"
|
||||
"nixos-wiki"
|
||||
"nixpkgs"
|
||||
"nixpkgs-issues"
|
||||
"noogle"
|
||||
"nuschtos"
|
||||
"protondb"
|
||||
"steamdb"
|
||||
"wikiless"
|
||||
"youtube"
|
||||
];
|
||||
description = "Additional search engines for LibreWolf.";
|
||||
};
|
||||
};
|
||||
|
||||
config.programs.librewolf = {
|
||||
profiles.default.search.engines = mapAttrs (_: name: transformedEngines.${name}) (
|
||||
listToAttrs (
|
||||
map (name: {
|
||||
name = name;
|
||||
value = name;
|
||||
}) cfg.searchEngines
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
87
modules/home/librewolf/search/engines.nix
Normal file
87
modules/home/librewolf/search/engines.nix
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
pkgs:
|
||||
|
||||
{
|
||||
github = {
|
||||
url = "https://github.com/search?q={searchTerms}";
|
||||
icon = "https://github.com/favicon.ico";
|
||||
alias = "@gh";
|
||||
};
|
||||
|
||||
home-manager-options = {
|
||||
url = "https://home-manager-options.extranix.com/?query={searchTerms}&release=release-25.11";
|
||||
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
|
||||
alias = "@hm";
|
||||
};
|
||||
|
||||
nixpkgs = {
|
||||
url = "https://search.nixos.org/packages?channel=25.11&query={searchTerms}";
|
||||
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
|
||||
alias = "@np";
|
||||
};
|
||||
|
||||
nixos-options = {
|
||||
url = "https://search.nixos.org/options?channel=25.11&query={searchTerms}";
|
||||
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
|
||||
alias = "@no";
|
||||
};
|
||||
|
||||
nixos-wiki = {
|
||||
url = "https://wiki.nixos.org/w/index.php?search={searchTerms}";
|
||||
icon = "https://wiki.nixos.org/favicon.png";
|
||||
alias = "@nw";
|
||||
};
|
||||
|
||||
noogle = {
|
||||
url = "https://noogle.dev/q?term={searchTerms}";
|
||||
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
|
||||
alias = "@nf";
|
||||
};
|
||||
|
||||
nuschtos = {
|
||||
url = "https://search.xn--nschtos-n2a.de/?query={searchTerms}";
|
||||
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
|
||||
alias = "@nu";
|
||||
};
|
||||
|
||||
nixpkgs-issues = {
|
||||
url = "https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue%20state%3Aopen%20{searchTerms}";
|
||||
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
|
||||
alias = "@ni";
|
||||
};
|
||||
|
||||
wikiless = {
|
||||
url = "https://wikiless.metastem.su/wiki/{searchTerms}";
|
||||
icon = "https://wikiless.metastem.su/wikiless-favicon.ico";
|
||||
alias = "@wiki";
|
||||
};
|
||||
|
||||
youtube = {
|
||||
url = "https://www.youtube.com/results?search_query={searchTerms}";
|
||||
icon = "https://www.youtube.com/favicon.ico";
|
||||
alias = "@yt";
|
||||
};
|
||||
|
||||
protondb = {
|
||||
url = "https://www.protondb.com/search?q={searchTerms}";
|
||||
icon = "https://www.protondb.com/favicon.ico";
|
||||
alias = "@pdb";
|
||||
};
|
||||
|
||||
steamdb = {
|
||||
url = "https://steamdb.info/search/?a=all&q={searchTerms}";
|
||||
icon = "https://steamdb.info/favicon.ico";
|
||||
alias = "@stdb";
|
||||
};
|
||||
|
||||
keyforsteam = {
|
||||
url = "https://www.keyforsteam.de/katalog/?search_name={searchTerms}";
|
||||
icon = "https://www.keyforsteam.de/favicon.ico";
|
||||
alias = "@k4s";
|
||||
};
|
||||
|
||||
howlongtobeat = {
|
||||
url = "https://howlongtobeat.com/?q={searchTerms}";
|
||||
icon = "https://howlongtobeat.com/favicon.ico";
|
||||
alias = "@hltb";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue