Refactor back to a more modular configuration

This commit is contained in:
Oliver Davies 2025-04-23 14:19:05 +01:00
parent 19ea08a716
commit 2bedd41d83
178 changed files with 2245 additions and 1847 deletions

View file

@ -0,0 +1,10 @@
{
imports = [
./firefox.nix
./flameshot.nix
./gtk.nix
./qutebrowser.nix
./mpv.nix
./screenkey.nix
];
}

View file

@ -0,0 +1,124 @@
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.homeManagerModules.desktop.firefox;
in
{
options.homeManagerModules.desktop.firefox.enable = mkEnableOption "Enable firefox";
config = mkIf cfg.enable {
programs.firefox.enable = false;
programs.librewolf = {
enable = true;
languagePacks = [ "en-GB" ];
policies = {
CaptivePortal = false;
DisableFirefoxAccounts = true;
DisableFirefoxStudies = true;
DisablePocket = true;
DisableTelemetry = true;
EnableTrackingProtection = {
Cryptomining = true;
Fingerprinting = true;
Value = true;
};
ExtensionSettings = {
"jid1-ZAdIEUB7XOzOJw@jetpack" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/duckduckgo-for-firefox/latest.xpi";
installation_mode = "force_installed";
};
"uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
installation_mode = "force_installed";
};
};
FirefoxHome = {
Highlights = false;
Pocket = false;
Search = true;
Snippets = false;
SponsoredPocket = false;
SponsoredTopSites = false;
TopSites = true;
};
FirefoxSuggest = {
ImproveSuggest = false;
SponsoredSuggestions = false;
WebSuggestions = false;
};
NoDefaultBookmarks = true;
OfferToSaveLogins = false;
OfferToSaveLoginsDefault = false;
PasswordManagerEnabled = false;
Preferences = {
"cookiebanners.service.mode" = 2; # Block cookie banners
"cookiebanners.service.mode.privateBrowsing" = 2; # Block cookie banners in private browsing
"privacy.donottrackheader.enabled" = true;
"privacy.fingerprintingProtection" = true;
"privacy.resistFingerprinting" = true;
"privacy.trackingprotection.emailtracking.enabled" = true;
"privacy.trackingprotection.enabled" = true;
"privacy.trackingprotection.fingerprinting.enabled" = true;
"privacy.trackingprotection.socialtracking.enabled" = true;
};
HardwareAcceleration = true;
TranslateEnabled = true;
UserMessaging = {
ExtensionRecommendations = false;
UrlbarInterventions = false;
SkipOnboarding = true;
};
};
profiles = {
default = {
extensions.packages = with pkgs.nur.repos.rycee.firefox-addons; [
awesome-rss
bitwarden
darkreader
onetab
tree-style-tab
ublock-origin
videospeed
vimium
web-developer
];
search = {
default = "ddg";
force = true;
privateDefault = "ddg";
};
settings = {
"browser.search.isUS" = false;
"browser.search.region" = "GB";
"distribution.searchplugins.defaultLocale" = "en-GB";
"general.useragent.locale" = "en-GB";
"intl.accept_languages" = "en-GB, en";
"intl.regional_prefs.use_os_locales" = true;
};
};
};
};
};
}

View file

@ -0,0 +1,26 @@
{ config, lib, ... }:
with lib;
let
cfg = config.homeManagerModules.desktop.flameshot;
in
{
options.homeManagerModules.desktop.flameshot.enable = mkEnableOption "Enable flameshot";
config = mkIf cfg.enable {
services.flameshot = {
enable = true;
settings = {
General = {
disabledTrayIcon = false;
saveAfterCopy = true;
savePath = "${config.xdg.userDirs.pictures}/Screenshots";
showHelp = false;
uiColor = "#60a5fa";
};
};
};
};
}

View file

@ -0,0 +1,34 @@
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.homeManagerModules.desktop.gtk;
in
{
options.homeManagerModules.desktop.gtk.enable = mkEnableOption "Enable gtk";
config = mkIf cfg.enable {
gtk = with pkgs; {
enable = true;
theme = {
name = "Arc-Dark";
package = arc-theme;
};
iconTheme = {
name = "Arc";
package = arc-icon-theme;
};
gtk3.extraConfig.gtk-enable-animations = false;
gtk4.extraConfig.gtk-enable-animations = false;
};
};
}

View file

@ -0,0 +1,22 @@
{ config, lib, ... }:
with lib;
let
cfg = config.homeManagerModules.desktop.mpv;
in
{
options.homeManagerModules.desktop.mpv.enable = mkEnableOption "Enable mpv";
config = mkIf cfg.enable {
programs.mpv = {
enable = true;
# https://github.com/mpv-player/mpv/blob/master/etc/input.conf
bindings = {
"DOWN" = "add volume -5";
"UP" = "add volume 5";
};
};
};
}

View file

@ -0,0 +1,41 @@
{ config, lib, ... }:
with lib;
let
cfg = config.homeManagerModules.desktop.qutebrowser;
in
{
options.homeManagerModules.desktop.qutebrowser.enable = mkEnableOption "Enable qutebrowser";
config = mkIf cfg.enable {
programs.qutebrowser = {
enable = true;
searchEngines = {
dp = "https://www.drupal.org/project/{}";
du = "https://www.drupal.org/u/{}";
gh = "https://github.com/search?q={}";
mn = "https://mynixos.com/search?q={}";
nx = "https://search.nixos.org/packages?query={}";
};
settings = {
colors.webpage.darkmode.enabled = true;
};
keyBindings = {
normal = {
"<Ctrl-d>" = "config-cycle colors.webpage.darkmode.enabled true false";
"xb" = "config-cycle statusbar.show always never";
"xt" = "config-cycle tabs.show always never";
"xx" = mkMerge [
"config-cycle statusbar.show always never"
"config-cycle tabs.show always never"
];
};
};
};
};
}

View file

@ -0,0 +1,13 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [ screenkey ];
xdg.configFile."screenkey.json".text = builtins.toJSON {
key_mode = "composed";
mods_mode = "emacs";
persist = true;
size = "small";
timeout = 0.25;
};
}