Files
home/modules/home/apps.nix
Morten Olsen e384cc4829 updates
2025-12-25 00:56:49 +01:00

218 lines
6.4 KiB
Nix

# Application configuration module
#
# Manages configuration files for applications that don't have
# dedicated Home Manager modules. Uses home.file to place config files.
{
config,
pkgs,
lib,
...
}: let
cfg = config.modules.apps;
in {
options.modules.apps = {
enable = lib.mkEnableOption "application configurations";
aerospace = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable Aerospace window manager configuration (macOS only)";
};
};
zen-browser = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable Zen Browser configuration (macOS only)";
};
};
jellyfin-tui = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable Jellyfin TUI configuration";
};
serverUrl = lib.mkOption {
type = lib.types.str;
default = "";
description = "Jellyfin server URL";
};
serverName = lib.mkOption {
type = lib.types.str;
default = "Home Server";
description = "Display name for the Jellyfin server";
};
username = lib.mkOption {
type = lib.types.str;
default = "";
description = "Jellyfin username";
};
passwordFile = lib.mkOption {
type = lib.types.str;
default = "";
description = "Path to file containing Jellyfin password";
};
};
};
config = lib.mkIf cfg.enable {
programs.zen-browser = lib.mkIf cfg.zen-browser.enable {
enable = true;
policies = let
mkExtensionSettings = builtins.mapAttrs (_: pluginId: {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/${pluginId}/latest.xpi";
installation_mode = "force_installed";
});
in {
AutofillAddressEnabled = true;
AutofillCreditCardEnabled = false;
DisableAppUpdate = true;
DisableFeedbackCommands = true;
DisableFirefoxStudies = true;
DisablePocket = true;
DisableTelemetry = true;
DontCheckDefaultBrowser = true;
NoDefaultBookmarks = true;
OfferToSaveLogins = false;
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
ExtensionSettings = mkExtensionSettings {
#"78272b6fa58f4a1abaac99321d503a20@proton.me" = "proton-pass";
"{446900e4-71c2-419f-a6a7-df9c091e268b}" = "bitwarden-password-manager";
"{d7742d87-e61d-4b78-b8a1-b469842139fa}" = "vimium-ff";
"readeck@readeck.com" = "readeck";
"@testpilot-containers" = "multi-account-containers";
"uBlock0@raymondhill.net" = "ublock-origin";
};
};
};
# Aerospace window manager configuration (macOS)
# Placed at ~/.aerospace.toml
home.file = lib.mkMerge [
# Aerospace configuration
(lib.mkIf cfg.aerospace.enable {
".aerospace.toml".text = ''
after-startup-command = []
start-at-login = true
enable-normalization-flatten-containers = true
enable-normalization-opposite-orientation-for-nested-containers = true
accordion-padding = 100
default-root-container-layout = 'tiles'
default-root-container-orientation = 'auto'
on-focused-monitor-changed = ['move-mouse monitor-lazy-center']
automatically-unhide-macos-hidden-apps = true
[[on-window-detected]]
if.app-name-regex-substring = 'elgato'
run = 'layout floating'
[key-mapping]
preset = 'qwerty'
[gaps]
inner.horizontal = 10
inner.vertical = 10
outer.left = 10
outer.bottom = 10
outer.top = 5
outer.right = 10
[mode.main.binding]
alt-ctrl-f = 'fullscreen'
alt-slash = 'layout tiles horizontal vertical'
alt-comma = 'layout accordion horizontal vertical'
alt-cmd-h = 'focus left'
alt-cmd-j = 'focus down'
alt-cmd-k = 'focus up'
alt-cmd-l = 'focus right'
cmd-shift-h = 'move left'
cmd-shift-j = 'move down'
cmd-shift-k = 'move up'
cmd-shift-l = 'move right'
alt-minus = 'resize smart -50'
alt-equal = 'resize smart +50'
alt-1 = 'workspace 1'
alt-2 = 'workspace 2'
alt-3 = 'workspace 3'
alt-4 = 'workspace 4'
alt-5 = 'workspace 5'
alt-6 = 'workspace 6'
alt-shift-1 = 'move-node-to-workspace 1'
alt-shift-2 = 'move-node-to-workspace 2'
alt-shift-3 = 'move-node-to-workspace 3'
alt-shift-4 = 'move-node-to-workspace 4'
alt-shift-5 = 'move-node-to-workspace 5'
alt-shift-6 = 'move-node-to-workspace 6'
alt-tab = 'workspace-back-and-forth'
alt-shift-tab = 'move-workspace-to-monitor --wrap-around next'
alt-shift-comma = 'mode service'
alt-shift-enter = 'mode apps'
alt-g = ['exec-and-forget open -a /Applications/Ghostty.app', 'mode main']
[mode.service.binding]
esc = ['reload-config', 'mode main']
r = ['flatten-workspace-tree', 'mode main'] # reset layout
f = [
'layout floating tiling',
'mode main',
] # Toggle between floating and tiling layout
backspace = ['close-all-windows-but-current', 'mode main']
h = ['join-with left', 'mode main']
j = ['join-with down', 'mode main']
k = ['join-with up', 'mode main']
l = ['join-with right', 'mode main']
down = 'volume down'
up = 'volume up'
shift-down = ['volume set 0', 'mode main']
[mode.apps.binding]
g = ['exec-and-forget open -a /Applications/Ghostty.app', 'mode main']
'';
})
# Jellyfin TUI configuration (macOS uses ~/Library/Application Support/)
(lib.mkIf cfg.jellyfin-tui.enable {
"Library/Application Support/jellyfin-tui/config.yaml".text = ''
servers:
- name: ${cfg.jellyfin-tui.serverName}
password_file: ${cfg.jellyfin-tui.passwordFile}
url: ${cfg.jellyfin-tui.serverUrl}
username: ${cfg.jellyfin-tui.username}
'';
})
];
};
}