modules/browsers: add final-package for each browser

This commit is contained in:
Dmitriy Pleshevskiy 2024-10-09 21:52:12 +03:00
parent 5dc3fc10ca
commit 482349b94d
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
8 changed files with 48 additions and 21 deletions

View file

@ -31,7 +31,6 @@
package = pkgs.unstable.ollama;
};
local.programs.browsers.tor-browser.enable = true;
local.programs.communication = {
telegram = {

View file

@ -7,12 +7,9 @@
./users
];
# local.yubikey.enable = true;
################################################################################
# Programs
################################################################################
local.programs.browsers.tor-browser.enable = true;
################################################################################
# Services

View file

@ -35,7 +35,11 @@
################################################################################
local.programs.pass.enable = lib.mkDefault true;
local.programs.browsers.librewolf.enable = lib.mkDefault true;
local.programs.browsers = {
librewolf.enable = lib.mkDefault true;
tor-browser.enable = lib.mkDefault true;
ungoogled-chromium.enable = lib.mkDefault true;
};
security.sudo.extraRules = [{
commands = [

View file

@ -4,9 +4,10 @@ let
cfg = config.local.programs.browsers;
contPackages =
lib.optional cfg.tor-browser.enable cfg.tor-browser.package
++ lib.optional cfg.librewolf.enable cfg.librewolf.package
++ lib.optional cfg.mullvad-browser.enable cfg.mullvad-browser.package;
lib.optional cfg.tor-browser.enable cfg.tor-browser.finalPackage
++ lib.optional cfg.librewolf.enable cfg.librewolf.finalPackage
++ lib.optional cfg.mullvad-browser.enable cfg.mullvad-browser.finalPackage
++ lib.optional cfg.ungoogled-chromium.enable cfg.ungoogled-chromium.package;
hostPackages = lib.flip map contPackages (p:
let
@ -34,6 +35,7 @@ in
./tor-browser.nix
./mullvad-browser.nix
./librewolf.nix
./ungoogled-chromium.nix
];
config = lib.mkIf isEnable {

View file

@ -1,24 +1,27 @@
{ pkgs, lib, inputs, ... }:
{ config, pkgs, lib, inputs, ... }:
let
# isPassEnabled = config.local.programs.pass.enable;
cfg = config.local.programs.browsers.librewolf;
policiesJson = pkgs.callPackage ./policies.nix {
firefoxAddons = inputs.firefox-addons.packages."${pkgs.system}";
# withPassffAddon = isPassEnabled;
withRedirectorAddon = true;
withSidebarTabsAddon = true;
withAllSearchEngines = true;
};
librewolf' = with pkgs.unstable; librewolf.override {
extraPoliciesFiles = librewolf.unwrapped.extraPoliciesFiles ++ [ policiesJson ];
# nativeMessagingHosts = lib.optional isPassEnabled passff-host;
finalLibrewolf = cfg.package.override {
extraPoliciesFiles = cfg.package.unwrapped.extraPoliciesFiles ++ [ policiesJson ];
};
in
{
options.local.programs.browsers.librewolf = with lib; {
enable = mkEnableOption "librewolf";
package = mkPackageOption pkgs "librewolf" {} // { default = librewolf'; };
package = mkPackageOption pkgs "librewolf" {};
finalPackage = mkOption {
type = types.package;
readOnly = true;
default = finalLibrewolf;
};
};
}

View file

@ -1,6 +1,8 @@
{ pkgs, lib, inputs, ... }:
{ config, pkgs, lib, inputs, ... }:
let
cfg = config.local.programs.browsers.mullvad-browser;
policiesJson = pkgs.callPackage ./policies.nix {
firefoxAddons = inputs.firefox-addons.packages."${pkgs.system}";
withRedirectorAddon = true;
@ -8,7 +10,7 @@ let
withAllSearchEngines = true;
};
mullvadBrowser = pkgs.mullvad-browser.overrideAttrs (attrs: {
finalMullvadBrowser = cfg.package.overrideAttrs (attrs: {
postInstall = ''
rm $out/share/mullvad-browser/distribution/policies.json
@ -19,6 +21,11 @@ in
{
options.local.programs.browsers.mullvad-browser = with lib; {
enable = mkEnableOption "mullvad-browser";
package = mkPackageOption pkgs "mullvad-browser" {} // { default = mullvadBrowser; };
package = mkPackageOption pkgs "mullvad-browser" {};
finalPackage = mkOption {
type = types.package;
readOnly = true;
default = finalMullvadBrowser;
};
};
}

View file

@ -1,9 +1,11 @@
{ pkgs, lib, ... }:
{ config, pkgs, lib, ... }:
let
cfg = config.local.programs.browsers.tor-browser;
policiesJson = pkgs.callPackage ./policies.nix { };
torBrowser = (pkgs.tor-browser-bundle-bin.override {
finalTorBrowser = (cfg.package.override {
mediaSupport = true;
pulseaudioSupport = true;
}).overrideAttrs (attrs: {
@ -16,6 +18,11 @@ in
{
options.local.programs.browsers.tor-browser = with lib; {
enable = mkEnableOption "tor-browser";
package = mkPackageOption pkgs "tor-browser-bundle-bin" {} // { default = torBrowser; };
package = mkPackageOption pkgs "tor-browser-bundle-bin" {};
finalPackage = mkOption {
type = types.package;
readOnly = true;
default = finalTorBrowser;
};
};
}

View file

@ -0,0 +1,8 @@
{ pkgs, lib, ... }:
{
options.local.programs.browsers.ungoogled-chromium = with lib; {
enable = mkEnableOption "ungoogled-chromium";
package = mkPackageOption pkgs "ungoogled-chromium" {};
};
}