Add zen and librewolf configuration

This commit is contained in:
DashieTM 2025-03-12 11:11:10 +01:00
parent dc83628ac9
commit 1886700857
10 changed files with 219 additions and 62 deletions

View file

@ -106,10 +106,12 @@
pkgs pkgs
stable stable
; ;
system = currentSystem;
lib = inputs.nixpkgs.lib; lib = inputs.nixpkgs.lib;
}; };
docs = import ./docs { docs = import ./docs {
inherit inputs pkgs stable; inherit inputs pkgs stable;
system = currentSystem;
lib = inputs.nixpkgs.lib; lib = inputs.nixpkgs.lib;
build_systems = dashNixLib.build_systems; build_systems = dashNixLib.build_systems;
}; };

View file

@ -10,6 +10,7 @@
pkgs, pkgs,
root, root,
alternativePkgs, alternativePkgs,
system,
... ...
}: { }: {
xdg = { xdg = {
@ -23,7 +24,7 @@
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs root additionalInputs alternativePkgs; inherit inputs root additionalInputs alternativePkgs system;
}; };
users.${config.conf.username} = { users.${config.conf.username} = {
@ -32,6 +33,7 @@
./common.nix ./common.nix
./themes ./themes
./sync.nix ./sync.nix
../modules/programs/browser/foxwrappers.nix
] ]
++ homeMods ++ homeMods
++ additionalHomeMods ++ additionalHomeMods

View file

@ -4,6 +4,7 @@
pkgs, pkgs,
self, self,
stable, stable,
system,
... ...
}: { }: {
/* /*
@ -84,6 +85,7 @@
inputs inputs
mod mod
additionalHomeConfig additionalHomeConfig
system
root root
; ;
pkgs = lib.mkForce ( pkgs = lib.mkForce (

View file

@ -1,8 +1,9 @@
{ {
imports = [ imports = [
./firefox.nix
./zen.nix
./chromium.nix
./brave.nix ./brave.nix
./chromium.nix
./firefox.nix
./librewolf.nix
./zen.nix
]; ];
} }

View file

@ -70,7 +70,7 @@
value = { value = {
isDefault = true; isDefault = true;
id = 0; id = 0;
extensions.packages = [ pkgs.nur.repos.rycee.firefox-addons.darkreader ]; extensions.packages = [pkgs.nur.repos.rycee.firefox-addons.darkreader];
}; };
} }
]; ];

View file

@ -0,0 +1,25 @@
{inputs, ...}: let
mkFirefoxModule = import "${inputs.home-manager.outPath}/modules/programs/firefox/mkFirefoxModule.nix";
in {
imports = [
(mkFirefoxModule {
modulePath = [
"programs"
"zen-browser"
];
name = "Zen Browser";
wrappedPackageName = "zen-browser-unwrapped";
unwrappedPackageName = "zen-browser";
visible = true;
platforms = {
linux = {
vendorPath = ".zen";
configPath = ".zen";
};
darwin = {
configPath = "Library/Application Support/Zen";
};
};
})
];
}

View file

@ -0,0 +1,29 @@
{
lib,
config,
options,
...
}: {
options.mods.browser.librewolf = {
enable = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = "Enables the librwolf browser";
};
settings = lib.mkOption {
default = {};
example = {};
type = with lib.types; attrsOf anything;
description = "librewolf settings";
};
};
config = lib.mkIf config.mods.browser.librewolf.enable (
lib.optionalAttrs (options ? home.packages) {
programs.librewolf = {
enable = true;
settings = config.mods.browser.librewolf.settings;
};
}
);
}

View file

@ -2,8 +2,8 @@
lib, lib,
config, config,
options, options,
system,
inputs, inputs,
pkgs,
... ...
}: { }: {
options.mods.browser.zen = { options.mods.browser.zen = {
@ -13,11 +13,99 @@
type = lib.types.bool; type = lib.types.bool;
description = "Enables the zen browser"; description = "Enables the zen browser";
}; };
# TODO configure zen configuration = lib.mkOption {
default = {
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
DisablePocket = true;
DisplayBookmarksToolbar = "never";
DisplayMenuBar = "default-off";
CaptivePortal = false;
DisableFirefoxStudies = true;
DisableTelemetry = true;
DisableFirefoxAccounts = false;
NoDefaultBookmarks = true;
OfferToSaveLogins = false;
OfferToSaveLoginsDefault = false;
PasswordManagerEnabled = false;
FirefoxHome = {
Search = true;
Pocket = false;
Snippets = false;
TopSites = true;
Highlights = false;
};
UserMessaging = {
ExtensionRecommendations = false;
SkipOnboarding = true;
};
};
example = {};
type = with lib.types; attrsOf anything;
description = "Zen policy configuration. See https://mozilla.github.io/policy-templates/ for more information.";
};
profiles = lib.mkOption {
default = [
{
name = "${config.conf.username}";
value = {
isDefault = true;
id = 0;
};
}
{
name = "special";
value = {
isDefault = false;
id = 1;
};
}
];
example = [
{
name = "custom";
value = {
isDefault = true;
id = 0;
extensions.packages = [pkgs.nur.repos.rycee.firefox-addons.darkreader];
};
}
];
type = with lib.types; listOf (attrsOf anything);
description = "Zen profiles";
};
}; };
config = lib.mkIf config.mods.browser.zen.enable ( config = lib.mkIf config.mods.browser.zen.enable (
lib.optionalAttrs (options ? home.packages) { lib.optionalAttrs (options ? home.packages) {
home.packages = [inputs.zen-browser.packages."${system}".default]; programs.zen-browser = {
enable = true;
package =
pkgs.wrapFirefox
(inputs.zen-browser.packages.${pkgs.system}.default.overrideAttrs (prevAttrs: {
passthru =
prevAttrs.passthru
or {}
// {
applicationName = "Zen Browser";
binaryName = "zen";
ffmpegSupport = true;
gssSupport = true;
gtk3 = pkgs.gtk3;
};
}))
{
icon = "zen-beta";
wmClass = "zen";
hasMozSystemDirPatch = false;
};
policies = config.mods.browser.zen.configuration;
profiles = builtins.listToAttrs config.mods.browser.zen.profiles;
};
} }
); );
} }

View file

@ -3,7 +3,6 @@
options, options,
config, config,
pkgs, pkgs,
inputs,
... ...
}: let }: let
# TODO remove when chromium works again # TODO remove when chromium works again
@ -72,12 +71,14 @@ in {
description = "The email client"; description = "The email client";
}; };
browser = lib.mkOption { browser = lib.mkOption {
default = inputs.zen-browser.packages.${pkgs.system}.default; default = "zen";
example = "firefox"; example = "firefox";
type = with lib.types; type = with lib.types;
nullOr ( nullOr (
either (enum [ either (enum [
"firefox" "firefox"
"zen"
"librewolf"
]) ])
package package
); );
@ -150,11 +151,23 @@ in {
profiles = builtins.listToAttrs config.mods.browser.firefox.profiles; profiles = builtins.listToAttrs config.mods.browser.firefox.profiles;
}; };
} }
else if config.mods.homePackages.browser == "zen"
then {
zen-browser = {
enable = true;
policies = config.mods.browser.zen.configuration;
profiles = builtins.listToAttrs config.mods.browser.zen.profiles;
};
}
else if config.mods.homePackages.browser == "librewolf"
then {
librewolf = {
enable = true;
settings = config.mods.browser.librewolf.settings;
};
}
else {} else {}
); );
services = services = config.mods.homePackages.specialServices;
if config.mods.homePackages.useDefaultPackages
then config.mods.homePackages.specialServices
else config.mods.homePackages.specialServices;
}; };
} }

View file

@ -4,8 +4,7 @@
config, config,
pkgs, pkgs,
... ...
}: }: {
{
options.mods.media = { options.mods.media = {
useBasePackages = lib.mkOption { useBasePackages = lib.mkOption {
default = true; default = true;
@ -14,24 +13,24 @@
description = "Default media packages (If disabled, only the additional packages will be installed)"; description = "Default media packages (If disabled, only the additional packages will be installed)";
}; };
additionalPackages = lib.mkOption { additionalPackages = lib.mkOption {
default = [ ]; default = [];
example = [ pkgs.flatpak ]; example = [pkgs.flatpak];
type = with lib.types; listOf package; type = with lib.types; listOf package;
description = '' description = ''
Additional media packages. Additional media packages.
''; '';
}; };
specialPrograms = lib.mkOption { specialPrograms = lib.mkOption {
default = { }; default = {};
example = { }; example = {};
type = with lib.types; attrsOf anything; type = with lib.types; attrsOf anything;
description = '' description = ''
special program configuration to be added which require programs.something notation. special program configuration to be added which require programs.something notation.
''; '';
}; };
specialServices = lib.mkOption { specialServices = lib.mkOption {
default = { }; default = {};
example = { }; example = {};
type = with lib.types; attrsOf anything; type = with lib.types; attrsOf anything;
description = '' description = ''
special services configuration to be added which require an services.something notation. special services configuration to be added which require an services.something notation.
@ -40,7 +39,8 @@
}; };
config = lib.optionalAttrs (options ? home.packages) { config = lib.optionalAttrs (options ? home.packages) {
home.packages = home.packages =
if config.mods.media.useBasePackages then if config.mods.media.useBasePackages
then
with pkgs; with pkgs;
[ [
# base audio # base audio
@ -70,21 +70,16 @@
yt-dlp yt-dlp
] ]
++ config.mods.media.additionalPackages ++ config.mods.media.additionalPackages
else else config.mods.media.additionalPackages;
config.mods.media.additionalPackages;
programs = programs =
if config.mods.media.useBasePackages then if config.mods.media.useBasePackages
then
{ {
obs-studio.enable = true; obs-studio.enable = true;
obs-studio.plugins = with pkgs; [ obs-studio-plugins.obs-vaapi ]; obs-studio.plugins = with pkgs; [obs-studio-plugins.obs-vaapi];
} }
// config.mods.media.specialPrograms // config.mods.media.specialPrograms
else else config.mods.media.specialPrograms;
config.mods.media.specialPrograms; services = config.mods.media.specialServices;
services =
if config.mods.media.useBasePackages then
config.mods.media.specialServices
else
config.mods.media.specialServices;
}; };
} }