config/modules/home/apps/web/librewolf/default.nix

171 lines
4.8 KiB
Nix
Raw Normal View History

{
lib,
config,
pkgs,
2025-07-22 20:21:21 -04:00
inputs,
...
}:
with lib;
with lib.custom; let
cfg = config.apps.web.librewolf;
2025-07-22 20:21:21 -04:00
natsumi = pkgs.fetchFromGitHub {
owner = "greeeen-dev";
repo = "natsumi-browser";
2025-08-02 16:20:18 -04:00
rev = "6012032cc45f57723b997385cd4b55cc11483196";
hash = "sha256-gstoNN7GPpPGDS3fWzyVoWIr6QXt6kMVR0oHc1ejNT4=";
2025-07-22 20:21:21 -04:00
};
in {
options.apps.web.librewolf = with types; {
2025-03-22 16:03:07 -04:00
enable = mkBoolOpt false "Enable or disable librewolf";
2025-03-22 16:03:07 -04:00
setDefault = mkBoolOpt false "Set Librewolf as default browser";
};
config = mkIf cfg.enable {
xdg.mimeApps.defaultApplications = mkIf cfg.setDefault {
"text/html" = "librewolf.desktop";
"x-scheme-handler/http" = "librewolf.desktop";
"x-scheme-handler/https" = "librewolf.desktop";
};
2025-07-22 20:21:21 -04:00
home.file.".librewolf/${config.home.username}/chrome" = {
source = "${natsumi}";
recursive = true;
};
programs.librewolf = {
enable = true;
2025-03-22 16:03:07 -04:00
2025-07-22 20:21:21 -04:00
profiles.default = lib.mkForce {
id = 1;
isDefault = false;
2025-08-02 16:20:18 -04:00
extensions = {
force = true;
};
2025-07-22 20:21:21 -04:00
};
2025-03-22 16:03:07 -04:00
profiles.${config.home.username} = {
id = 0;
isDefault = true;
2025-08-02 16:20:18 -04:00
extensions = {
force = true;
};
2025-07-22 20:21:21 -04:00
2025-08-02 16:20:18 -04:00
settings = {
2025-07-22 20:21:21 -04:00
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
"sidebar.verticalTabs" = true;
2025-08-02 16:20:18 -04:00
"webgl.disabled" = false;
"privacy.resistFingerprinting" = false;
"privacy.clearOnShutdown.history" = false;
"privacy.clearOnShutdown.cookies" = false;
"network.cookie.lifetimePolicy" = 0;
2025-07-22 20:21:21 -04:00
"natsumi.theme.type" = "default";
2025-03-22 16:03:07 -04:00
};
2025-07-22 20:21:21 -04:00
search = {
default = "SearXNG";
engines = {
"NixOS Options" = {
urls = [
{
template = "https://search.nixos.org/options?query={searchTerms}";
}
];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@nixos"];
};
"Nix Packages" = {
urls = [
{
template = "https://search.nixos.org/packages?query={searchTerms}";
}
];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = ["@nixpkgs"];
};
"OpenStreetMap" = {
urls = [
{
template = "https://www.openstreetmap.org/search?query={searchTerms}";
}
];
icon = "https://www.openstreetmap.org/favicon.ico";
2025-08-02 16:20:18 -04:00
definedAliases = [
"@openstreetmap"
"@osm"
];
2025-07-22 20:21:21 -04:00
};
"SearXNG" = {
urls = [
{
template = "https://search.zoeys.computer/searx/search?q={searchTerms}";
}
];
icon = "https://search.zoeys.computer/searx/static/themes/simple/img/favicon.svg";
definedAliases = ["@searx"];
};
"docs.rs" = {
urls = [
{
template = "https://docs.rs/releases/search?query={searchTerms}";
}
];
icon = "https://docs.rs/-/static/favicon.ico";
definedAliases = ["@docs"];
};
"crates.io" = {
urls = [
{
template = "https://crates.io/search?q={searchTerms}";
}
];
icon = "https://crates.io/assets/cargo.png";
definedAliases = ["@crates"];
};
};
force = true; # Required to prevent search engine symlink being overwritten. See https://github.com/nix-community/home-manager/issues/3698
};
};
policies = {
2025-03-22 16:03:07 -04:00
ExtensionSettings = with builtins; let
extension = shortId: uuid: {
name = uuid;
value = {
install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi";
installation_mode = "normal_installed";
};
};
in
listToAttrs [
(extension "ublock-origin" "uBlock0@raymondhill.net")
(extension "privacy-badger17" "jid1-MnnxcxisBPnSXQ@jetpack")
(extension "1password-x-password-manager" "{d634138d-c276-4fc8-924b-40a0ea21d284}")
(extension "styl-us" "{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}")
(extension "betterttv" "firefox@betterttv.net")
(extension "decentraleyes" "jid1-BoFifL9Vbdl2zQ@jetpack")
(extension "canvasblocker" "CanvasBlocker@kkapsner.de")
(extension "clearurls" "{74145f27-f039-47ce-a470-a662b129930a}")
];
};
};
};
}