This commit is contained in:
2025-03-28 22:46:22 -04:00
parent a78b85b344
commit f06bbcbdad
15 changed files with 317 additions and 58 deletions

View File

@@ -0,0 +1,112 @@
{ config, lib, pkgs, namespace, ... }:
let
inherit (lib)
types
mkIf
mkMerge
optionalAttrs
;
inherit (lib.${namespace}) mkBoolOpt mkOpt;
cfg = config.${namespace}.programs.browsers.firefox;
in
{
imports = lib.snowfall.fs.get-non-default-nix-files ./.;
options.${namespace}.programs.browsers.firefox = with types; {
enable = lib.mkEnableOption "Firefox";
extraConfig = mkOpt str "" "Extra configuration for the user profile JS file.";
gpuAcceleration = mkBoolOpt false "Enable GPU acceleration.";
hardwareDecoding = mkBoolOpt false "Enable hardware video decoding.";
policies = mkOpt attrs
{
CaptivePortal = false;
DisableFirefoxStudies = true;
DisableFormHistory = true;
DisablePocket = true;
DisableTelemetry = true;
DisplayBookmarksToolbar = false;
DontCheckDefaultBrowser = true;
FirefoxHome = {
Pocket = false;
Snippets = false;
};
PasswordManagerEnabled = false;
UserMessaging = {
ExtensionRecommendations = false;
SkipOnboarding = true;
};
ExtensionSettings = {
# Block All
# "*".installation_mode = "blocked";
# Bypass Paywalls
"magnolia@12.34" = {
install_url = "https://gitflic.ru/project/magnolia1234/bpc_uploads/blob/raw?file=bypass_paywalls_clean-latest.xpi";
installation_mode = "force_installed";
};
};
Preferences = { };
} "Policies to apply to firefox";
settings = mkOpt attrs { } "Settings to apply to the profile.";
extensions = mkOpt (with lib.types; listOf package)
(with pkgs.firefox-addons; [
bitwarden
darkreader
kagi-search
sponsorblock
ublock-origin
# bypass-paywalls-clean
]) "Extensions to install";
};
config = mkIf cfg.enable {
programs.firefox = {
enable = true;
inherit (cfg) policies;
profiles = {
${config.${namespace}.user.name} = {
inherit (cfg) extraConfig extensions;
inherit (config.${namespace}.user) name;
id = 0;
settings = mkMerge [
cfg.settings
{
"browser.aboutConfig.showWarning" = false;
"browser.aboutwelcome.enabled" = false;
"browser.sessionstore.warnOnQuit" = true;
"browser.shell.checkDefaultBrowser" = false;
"general.smoothScroll.msdPhysics.enabled" = true;
"intl.accept_languages" = "en-US,en";
# "devtools.chrome.enabled" = true;
# "xpinstall.signatures.required" = false;
}
(optionalAttrs cfg.gpuAcceleration {
"dom.webgpu.enabled" = true;
"gfx.webrender.all" = true;
"layers.gpu-process.enabled" = true;
"layers.mlgpu.enabled" = true;
})
(optionalAttrs cfg.hardwareDecoding {
"media.ffmpeg.vaapi.enabled" = true;
"media.gpu-process-decoder" = true;
"media.hardware-video-decoding.enabled" = true;
})
];
# userChrome = ./chrome/userChrome.css;
};
};
};
};
}

View File

@@ -20,7 +20,7 @@ in
SHELL="$BASH"
PATH=~/.bin:$PATH
eval "$(thefuck --alias)"
set -o vi
set -o vi || true
bind "set show-mode-in-prompt on"
fastfetch
'';

View File

@@ -26,6 +26,9 @@ in
}
];
extraConfig = {
user = {
email = "evan@reichard.io";
};
core = {
autocrlf = "input";
safecrlf = "true";

View File

@@ -11,6 +11,7 @@ in
config = mkIf cfg.enable {
wayland.windowManager.hyprland = {
enable = true;
# systemd.enable = false;
extraConfig = builtins.readFile ./config/hyprland.conf;
};

View File

@@ -0,0 +1,51 @@
{ config, lib, pkgs, namespace, ... }:
let
inherit (lib)
types
mkIf
mkDefault
mkMerge
;
inherit (lib.${namespace}) mkOpt;
cfg = config.${namespace}.user;
home-directory =
if cfg.name == null then
null
else if pkgs.stdenv.hostPlatform.isDarwin then
"/Users/${cfg.name}"
else
"/home/${cfg.name}";
in
{
options.${namespace}.user = {
enable = mkOpt types.bool false "Whether to configure the user account.";
email = mkOpt types.str "evan@reichard.io" "The email of the user.";
fullName = mkOpt types.str "Evan Reichard" "The full name of the user.";
home = mkOpt (types.nullOr types.str) home-directory "The user's home directory.";
name = mkOpt (types.nullOr types.str) config.snowfallorg.user.name "The user account.";
};
config = mkIf cfg.enable (mkMerge [
{
assertions = [
{
assertion = cfg.name != null;
message = "${namespace}.user.name must be set";
}
{
assertion = cfg.home != null;
message = "${namespace}.user.home must be set";
}
];
home = {
homeDirectory = mkDefault cfg.home;
username = mkDefault cfg.name;
};
programs.home-manager.enable = true;
}
]);
}