refactor: reorganize features

This commit is contained in:
2026-04-27 16:47:12 +02:00
parent 0b2ecd31b0
commit 93624900ad
18 changed files with 193 additions and 206 deletions
@@ -1,26 +1,39 @@
{ config, ... }: { config, ... }:
let let
repo = config.repo; repo = config.repo;
repoHelpers = repo.helpers;
in in
{ {
flake.modules.homeManager.xdg = flake.modules.homeManager.desktop-defaults =
{ config, pkgs, ... }: { config, pkgs, ... }:
let let
browserPackage = repoHelpers.resolvePackagePath { browserPackage = pkgs.${repo.desktop.browser.packageAttr};
inherit pkgs; fileManagerPackage = pkgs.${repo.desktop.fileManager.packageAttr};
path = repo.desktop.browser.packagePath;
};
fileManagerPackage = repoHelpers.resolvePackagePath {
inherit pkgs;
path = repo.desktop.fileManager.packagePath;
};
homeDir = config.home.homeDirectory; homeDir = config.home.homeDirectory;
localDir = "${homeDir}/.local"; localDir = "${homeDir}/.local";
mediaDir = "${homeDir}/media"; mediaDir = "${homeDir}/media";
in in
{ {
home.preferXdgDirectories = true; home.preferXdgDirectories = true;
home.sessionVariables.BROWSER = repo.desktop.browser.command;
home.packages =
with pkgs;
[
postman
spotify
calcure
planify
unzip
gimp
dbeaver-bin
]
++ [
browserPackage
fileManagerPackage
];
programs.imv.enable = true;
programs.sioyek.enable = true;
xdg = { xdg = {
enable = true; enable = true;
-88
View File
@@ -1,88 +0,0 @@
{ config, ... }:
let
account = config.repo.account;
in
{
flake.modules.homeManager.email =
{
config,
lib,
...
}:
let
mkOffice365Account =
{
address,
primary,
...
}:
{
enable = true;
inherit address primary;
realName = account.realName;
userName = address;
thunderbird = {
enable = true;
settings = id: {
"mail.smtpserver.smtp_${id}.authMethod" = 10;
"mail.server.server_${id}.authMethod" = 10;
};
};
flavor = "outlook.office365.com";
};
mkMxrouteAccount =
{
address,
primary,
...
}:
{
enable = true;
inherit address primary;
realName = account.realName;
userName = address;
thunderbird.enable = true;
imap = {
authentication = "plain";
host = "taylor.mxrouting.net";
port = 993;
tls.enable = true;
};
smtp = {
authentication = "plain";
host = "taylor.mxrouting.net";
port = 465;
tls.enable = true;
};
};
mkEmailAccount =
email:
if email.type == "office365" then
mkOffice365Account email
else if email.type == "mxrouting" then
mkMxrouteAccount email
else
throw "Unsupported email type `${email.type}` for ${config.home.username}";
in
{
programs.thunderbird = {
enable = true;
profiles.${config.home.username} = {
isDefault = true;
withExternalGnupg = true;
settings = {
"mail.ui.display.message_pane_vertical" = true;
"mail.ui.display.thread_pane_view_type" = "cards";
"mail.uidensity" = 1;
"privacy.donottrackheader.enabled" = true;
"mail.server.server2.hidden" = true;
"mailnews.start_page.enabled" = false;
"mail.provider.enabled" = false;
"layout.css.devPixelsPerPx" = 0.85;
};
};
};
accounts.email.accounts = lib.mapAttrs (_: mkEmailAccount) account.emails;
};
}
-34
View File
@@ -1,34 +0,0 @@
{ config, ... }:
let
repo = config.repo;
repoHelpers = repo.helpers;
in
{
flake.modules.homeManager.local-apps =
{ pkgs, ... }:
let
browserPackage = repoHelpers.resolvePackagePath {
inherit pkgs;
path = repo.desktop.browser.packagePath;
};
in
{
home.sessionVariables.BROWSER = repo.desktop.browser.command;
home.packages =
with pkgs;
[
postman
spotify
calcure
planify
unzip
gimp
dbeaver-bin
]
++ [ browserPackage ];
programs.imv.enable = true;
programs.sioyek.enable = true;
};
}
@@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
flake.modules.nixos.region-nl = { flake.modules.nixos.locale-nl = {
time.timeZone = "Europe/Amsterdam"; time.timeZone = "Europe/Amsterdam";
i18n.defaultLocale = "en_US.UTF-8"; i18n.defaultLocale = "en_US.UTF-8";
+1 -1
View File
@@ -6,7 +6,7 @@
}; };
}; };
flake.modules.nixos.networking = { flake.modules.nixos.network-manager = {
networking = { networking = {
nftables.enable = true; nftables.enable = true;
networkmanager.enable = true; networkmanager.enable = true;
-14
View File
@@ -1,14 +0,0 @@
{ config, ... }:
let
account = config.repo.account;
in
{
flake.modules.homeManager.nh =
{ ... }:
{
programs.nh = {
enable = true;
flake = account.nixosConfigurationPath;
};
};
}
+1 -12
View File
@@ -5,7 +5,6 @@
}: }:
let let
repo = config.repo; repo = config.repo;
repoHelpers = repo.helpers;
in in
{ {
flake.modules.nixos.niri = flake.modules.nixos.niri =
@@ -34,10 +33,7 @@ in
let let
repoTheme = repo.theme.kanagawa; repoTheme = repo.theme.kanagawa;
browserCommand = repo.desktop.browser.command; browserCommand = repo.desktop.browser.command;
fileManagerPackage = repoHelpers.resolvePackagePath { fileManagerPackage = pkgs.${repo.desktop.fileManager.packageAttr};
inherit pkgs;
path = repo.desktop.fileManager.packagePath;
};
terminalCommand = config.repo.terminal.primary.command; terminalCommand = config.repo.terminal.primary.command;
outputs = lib.mapAttrs ( outputs = lib.mapAttrs (
_: display: _: display:
@@ -65,13 +61,6 @@ in
) osConfig.meta.machine.displays; ) osConfig.meta.machine.displays;
in in
{ {
assertions = [
{
assertion = fileManagerPackage != null;
message = "Unknown file manager package `${lib.showAttrPath repo.desktop.fileManager.packagePath}`.";
}
];
home.sessionVariables.NIXOS_OZONE_WL = "1"; home.sessionVariables.NIXOS_OZONE_WL = "1";
dconf.settings = { dconf.settings = {
+9 -1
View File
@@ -1,4 +1,7 @@
{ inputs, ... }: { inputs, config, ... }:
let
account = config.repo.account;
in
{ {
flake.modules.nixos.nix = flake.modules.nixos.nix =
{ ... }: { ... }:
@@ -53,5 +56,10 @@
enable = true; enable = true;
enableTelevisionIntegration = true; enableTelevisionIntegration = true;
}; };
programs.nh = {
enable = true;
flake = account.nixosConfigurationPath;
};
}; };
} }
@@ -7,9 +7,8 @@ let
account = repo.account; account = repo.account;
in in
{ {
flake.modules.homeManager.bitwarden = flake.modules.homeManager.passwords =
{ {
config,
pkgs, pkgs,
... ...
}: }:
+85 -1
View File
@@ -4,9 +4,93 @@
}: }:
let let
repo = config.repo; repo = config.repo;
account = repo.account;
in in
{ {
flake.modules.homeManager.pim = flake.modules.homeManager.email =
{
config,
lib,
...
}:
let
mkOffice365Account =
{
address,
primary,
...
}:
{
enable = true;
inherit address primary;
realName = account.realName;
userName = address;
thunderbird = {
enable = true;
settings = id: {
"mail.smtpserver.smtp_${id}.authMethod" = 10;
"mail.server.server_${id}.authMethod" = 10;
};
};
flavor = "outlook.office365.com";
};
mkMxrouteAccount =
{
address,
primary,
...
}:
{
enable = true;
inherit address primary;
realName = account.realName;
userName = address;
thunderbird.enable = true;
imap = {
authentication = "plain";
host = "taylor.mxrouting.net";
port = 993;
tls.enable = true;
};
smtp = {
authentication = "plain";
host = "taylor.mxrouting.net";
port = 465;
tls.enable = true;
};
};
mkEmailAccount =
email:
if email.type == "office365" then
mkOffice365Account email
else if email.type == "mxrouting" then
mkMxrouteAccount email
else
throw "Unsupported email type `${email.type}` for ${config.home.username}";
in
{
programs.thunderbird = {
enable = true;
profiles.${config.home.username} = {
isDefault = true;
withExternalGnupg = true;
settings = {
"mail.ui.display.message_pane_vertical" = true;
"mail.ui.display.thread_pane_view_type" = "cards";
"mail.uidensity" = 1;
"privacy.donottrackheader.enabled" = true;
"mail.server.server2.hidden" = true;
"mailnews.start_page.enabled" = false;
"mail.provider.enabled" = false;
"layout.css.devPixelsPerPx" = 0.85;
};
};
};
accounts.email.accounts = lib.mapAttrs (_: mkEmailAccount) account.emails;
};
flake.modules.homeManager.calendar-tasks =
{ {
config, config,
... ...
+1 -1
View File
@@ -8,7 +8,7 @@ let
); );
in in
{ {
flake.modules.nixos.ssh-agent-auth = { flake.modules.nixos.sudo-ssh-agent-auth = {
security.pam = { security.pam = {
rssh.enable = true; rssh.enable = true;
services.sudo.rssh = true; services.sudo.rssh = true;
@@ -1,6 +1,6 @@
{ ... }: { ... }:
{ {
flake.modules.nixos.standard-boot = flake.modules.nixos.systemd-boot =
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
boot = { boot = {
-27
View File
@@ -2,31 +2,6 @@
let let
repo = config.repo; repo = config.repo;
mkPrimaryTerminalOption =
lib:
lib.mkOption {
type = lib.types.submodule {
options = {
package = lib.mkOption {
type = lib.types.package;
};
command = lib.mkOption {
type = lib.types.str;
};
desktopId = lib.mkOption {
type = lib.types.str;
};
execArgs = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
};
};
};
mkPrimaryTerminal = mkPrimaryTerminal =
{ {
desktopId, desktopId,
@@ -40,8 +15,6 @@ let
{ {
imports = [ terminalModule ]; imports = [ terminalModule ];
options.repo.terminal.primary = mkPrimaryTerminalOption lib;
config = { config = {
repo.terminal.primary = { repo.terminal.primary = {
inherit inherit
+2 -2
View File
@@ -27,12 +27,12 @@
desktop = { desktop = {
browser = { browser = {
command = "vivaldi"; command = "vivaldi";
packagePath = [ "vivaldi" ]; packageAttr = "vivaldi";
}; };
fileManager = { fileManager = {
command = "nautilus"; command = "nautilus";
packagePath = [ "nautilus" ]; packageAttr = "nautilus";
}; };
}; };
+1 -1
View File
@@ -25,7 +25,7 @@ in
nixosModules.openssh nixosModules.openssh
nixosModules.caddy nixosModules.caddy
nixosModules.server-firewall nixosModules.server-firewall
nixosModules.ssh-agent-auth nixosModules.sudo-ssh-agent-auth
nixosModules.vaultwarden nixosModules.vaultwarden
nixosModules.radicale nixosModules.radicale
nixosModules.actual nixosModules.actual
+60 -2
View File
@@ -81,6 +81,36 @@ let
} }
); );
desktopApplicationType = lib.types.submodule (
{ ... }:
{
options = {
command = lib.mkOption {
type = lib.types.str;
};
packageAttr = lib.mkOption {
type = lib.types.str;
};
};
}
);
desktopType = lib.types.submodule (
{ ... }:
{
options = {
browser = lib.mkOption {
type = desktopApplicationType;
};
fileManager = lib.mkOption {
type = desktopApplicationType;
};
};
}
);
displayType = lib.types.submodule ( displayType = lib.types.submodule (
{ ... }: { ... }:
{ {
@@ -163,6 +193,27 @@ let
}; };
} }
); );
terminalPrimaryType = lib.types.submodule {
options = {
package = lib.mkOption {
type = lib.types.package;
};
command = lib.mkOption {
type = lib.types.str;
};
desktopId = lib.mkOption {
type = lib.types.str;
};
execArgs = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
};
};
in in
{ {
options.repo = { options.repo = {
@@ -176,8 +227,7 @@ in
}; };
desktop = lib.mkOption { desktop = lib.mkOption {
type = lib.types.raw; type = desktopType;
default = { };
}; };
services = lib.mkOption { services = lib.mkOption {
@@ -199,4 +249,12 @@ in
}; };
}; };
config.flake.modules.homeManager.repo-schema =
{ ... }:
{
options.repo.terminal.primary = lib.mkOption {
type = terminalPrimaryType;
};
};
} }
+2 -1
View File
@@ -13,7 +13,7 @@ in
nixosModules.meta nixosModules.meta
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
nixosModules.nix nixosModules.nix
nixosModules.region-nl nixosModules.locale-nl
nixosModules.sops-password nixosModules.sops-password
]; ];
@@ -22,6 +22,7 @@ in
backupFileExtension = "bak"; backupFileExtension = "bak";
extraSpecialArgs = { inherit inputs; }; extraSpecialArgs = { inherit inputs; };
sharedModules = [ sharedModules = [
hmModules.repo-schema
hmModules.syncthing hmModules.syncthing
hmModules.shell hmModules.shell
hmModules.neovim hmModules.neovim
+5 -7
View File
@@ -13,13 +13,13 @@ in
nixosModules.bluetooth nixosModules.bluetooth
nixosModules.flatpak nixosModules.flatpak
nixosModules.fonts nixosModules.fonts
nixosModules.networking nixosModules.network-manager
nixosModules.niri nixosModules.niri
nixosModules.plymouth nixosModules.plymouth
nixosModules.printing nixosModules.printing
nixosModules.sddm nixosModules.sddm
nixosModules.sops-admin-key-file nixosModules.sops-admin-key-file
nixosModules.standard-boot nixosModules.systemd-boot
nixosModules.theme nixosModules.theme
nixosModules.ai nixosModules.ai
]; ];
@@ -37,16 +37,15 @@ in
flake.modules.homeManager.workstation-base = { flake.modules.homeManager.workstation-base = {
imports = [ imports = [
homeModules.ai homeModules.ai
homeModules.bitwarden homeModules.passwords
homeModules.clipboard homeModules.clipboard
homeModules.dev-tools homeModules.dev-tools
homeModules.desktop-defaults
homeModules.email homeModules.email
homeModules.local-apps
homeModules.mpv homeModules.mpv
homeModules.nh
homeModules.niri homeModules.niri
homeModules.nix homeModules.nix
homeModules.pim homeModules.calendar-tasks
homeModules.podman homeModules.podman
homeModules.qbittorrent-client homeModules.qbittorrent-client
homeModules.sops homeModules.sops
@@ -56,7 +55,6 @@ in
homeModules.terminal-kitty homeModules.terminal-kitty
homeModules.theme homeModules.theme
homeModules.vicinae homeModules.vicinae
homeModules.xdg
homeModules.noctalia homeModules.noctalia
]; ];
}; };