2022-06-15 21:26:52 +02:00
|
|
|
{ config, nixosConfig, pkgs, lib, ... }:
|
2020-08-14 23:41:20 +02:00
|
|
|
|
2020-08-15 02:30:01 +02:00
|
|
|
with lib;
|
2020-08-14 23:41:20 +02:00
|
|
|
let
|
2023-04-12 21:13:33 +02:00
|
|
|
firefox-addons = pkgs.nur.repos.rycee.firefox-addons
|
|
|
|
// (import ./firefoxAddons.nix { inherit pkgs lib; });
|
2020-08-15 02:30:01 +02:00
|
|
|
|
2023-04-25 18:32:26 +02:00
|
|
|
inherit (import ../modules/firefox/common.nix { inherit config lib pkgs; })
|
|
|
|
mkConfig;
|
2020-08-15 02:30:01 +02:00
|
|
|
|
2023-05-31 16:01:45 +02:00
|
|
|
arkenfoxConfig = builtins.readFile pkgs.nur.repos.slaier.arkenfox-userjs;
|
2021-05-11 20:58:03 +02:00
|
|
|
|
2023-04-25 18:32:26 +02:00
|
|
|
# Relax some arkenfox settings, to get a less strict
|
|
|
|
# alternative to Mullvad Browser to fallback on.
|
|
|
|
sharedSettings = {
|
|
|
|
# Enable restoring sessions
|
|
|
|
"browser.startup.page" = 3;
|
2020-10-03 16:48:01 +02:00
|
|
|
|
2023-04-25 18:32:26 +02:00
|
|
|
# Don't delete data on shutdown (cookies, sessions, windows, ...)
|
|
|
|
"privacy.sanitize.sanitizeOnShutdown" = false;
|
2020-08-25 21:34:43 +02:00
|
|
|
|
2023-04-25 18:32:26 +02:00
|
|
|
# Don't do default browser check
|
|
|
|
"browser.shell.checkDefaultBrowser" = false;
|
2020-12-25 12:01:55 +01:00
|
|
|
|
2023-04-25 18:32:26 +02:00
|
|
|
# Disable Pocket
|
2022-12-07 14:38:39 +01:00
|
|
|
"extensions.pocket.enabled" = false;
|
2023-05-31 16:01:45 +02:00
|
|
|
|
|
|
|
# Enable search in location bar
|
2023-06-12 10:56:00 +02:00
|
|
|
"keyword.enabled" = true;
|
2023-05-31 16:01:45 +02:00
|
|
|
|
|
|
|
# Enable IPv6 again
|
|
|
|
"network.dns.disableIPv6" = false;
|
2020-08-15 02:30:01 +02:00
|
|
|
};
|
2023-04-09 21:31:13 +02:00
|
|
|
|
2023-04-25 18:32:26 +02:00
|
|
|
# use extraConfig to load arkenfox user.js before settings
|
|
|
|
sharedExtraConfig = ''
|
|
|
|
${arkenfoxConfig}
|
|
|
|
|
|
|
|
${mkConfig sharedSettings}
|
|
|
|
'';
|
|
|
|
|
2023-04-12 20:55:57 +02:00
|
|
|
commonExtensions = with firefox-addons; [
|
2023-05-31 16:01:45 +02:00
|
|
|
german-dictionary
|
2023-04-12 20:55:57 +02:00
|
|
|
ublock-origin
|
|
|
|
bitwarden
|
|
|
|
libredirect
|
|
|
|
zotero-connector
|
|
|
|
];
|
2020-10-03 16:48:01 +02:00
|
|
|
in {
|
2020-08-14 23:41:20 +02:00
|
|
|
programs.firefox = {
|
|
|
|
enable = true;
|
|
|
|
profiles = {
|
|
|
|
private = {
|
|
|
|
id = 0;
|
2023-04-25 18:32:26 +02:00
|
|
|
extraConfig = sharedExtraConfig;
|
2023-05-31 17:25:46 +02:00
|
|
|
extensions = commonExtensions ++ (with firefox-addons; [ metamask ]);
|
2020-08-14 23:41:20 +02:00
|
|
|
};
|
|
|
|
work = {
|
|
|
|
id = 1;
|
2023-04-25 18:32:26 +02:00
|
|
|
extraConfig = sharedExtraConfig;
|
2023-05-31 17:25:46 +02:00
|
|
|
extensions = commonExtensions
|
|
|
|
++ (with firefox-addons; [ react-devtools reduxdevtools ]);
|
2020-08-14 23:41:20 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2020-08-15 02:32:23 +02:00
|
|
|
|
2020-08-25 21:34:43 +02:00
|
|
|
home.packages = let
|
2021-03-29 21:39:37 +02:00
|
|
|
makeFirefoxProfileBin = args@{ profile, ... }:
|
2020-08-25 21:34:43 +02:00
|
|
|
let
|
2021-03-29 21:39:37 +02:00
|
|
|
name = "firefox-${profile}";
|
2021-03-29 21:43:13 +02:00
|
|
|
scriptBin = pkgs.writeScriptBin name ''
|
2022-03-05 11:39:20 +01:00
|
|
|
firefox -P "${profile}" --name="${name}" $@
|
2020-10-03 16:48:01 +02:00
|
|
|
'';
|
2021-03-29 21:39:37 +02:00
|
|
|
desktopFile = pkgs.makeDesktopItem ((removeAttrs args [ "profile" ])
|
|
|
|
// {
|
|
|
|
inherit name;
|
|
|
|
exec = "${scriptBin}/bin/${name} %U";
|
2022-03-05 11:38:53 +01:00
|
|
|
extraConfig.StartupWMClass = name;
|
2021-03-29 21:39:37 +02:00
|
|
|
genericName = "Web Browser";
|
2022-03-05 11:38:53 +01:00
|
|
|
mimeTypes = [
|
2021-03-29 21:39:37 +02:00
|
|
|
"text/html"
|
|
|
|
"text/xml"
|
|
|
|
"application/xhtml+xml"
|
|
|
|
"application/vnd.mozilla.xul+xml"
|
|
|
|
"x-scheme-handler/http"
|
|
|
|
"x-scheme-handler/https"
|
|
|
|
];
|
2022-03-05 11:38:53 +01:00
|
|
|
categories = [ "Network" "WebBrowser" ];
|
2021-03-29 21:39:37 +02:00
|
|
|
});
|
|
|
|
in pkgs.runCommand name { } ''
|
|
|
|
mkdir -p $out/{bin,share}
|
|
|
|
cp -r ${scriptBin}/bin/${name} $out/bin/${name}
|
|
|
|
cp -r ${desktopFile}/share/applications $out/share/applications
|
|
|
|
'';
|
2023-04-12 20:57:18 +02:00
|
|
|
in [
|
2022-01-01 02:13:02 +01:00
|
|
|
(makeFirefoxProfileBin {
|
|
|
|
profile = "work";
|
|
|
|
desktopName = "Firefox (Work)";
|
|
|
|
icon = "firefox";
|
|
|
|
})
|
|
|
|
];
|
2020-08-14 23:41:20 +02:00
|
|
|
}
|