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, ... }:
let
repo = config.repo;
repoHelpers = repo.helpers;
in
{
flake.modules.homeManager.xdg =
flake.modules.homeManager.desktop-defaults =
{ config, pkgs, ... }:
let
browserPackage = repoHelpers.resolvePackagePath {
inherit pkgs;
path = repo.desktop.browser.packagePath;
};
fileManagerPackage = repoHelpers.resolvePackagePath {
inherit pkgs;
path = repo.desktop.fileManager.packagePath;
};
browserPackage = pkgs.${repo.desktop.browser.packageAttr};
fileManagerPackage = pkgs.${repo.desktop.fileManager.packageAttr};
homeDir = config.home.homeDirectory;
localDir = "${homeDir}/.local";
mediaDir = "${homeDir}/media";
in
{
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 = {
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";
i18n.defaultLocale = "en_US.UTF-8";
+1 -1
View File
@@ -6,7 +6,7 @@
};
};
flake.modules.nixos.networking = {
flake.modules.nixos.network-manager = {
networking = {
nftables.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
repo = config.repo;
repoHelpers = repo.helpers;
in
{
flake.modules.nixos.niri =
@@ -34,10 +33,7 @@ in
let
repoTheme = repo.theme.kanagawa;
browserCommand = repo.desktop.browser.command;
fileManagerPackage = repoHelpers.resolvePackagePath {
inherit pkgs;
path = repo.desktop.fileManager.packagePath;
};
fileManagerPackage = pkgs.${repo.desktop.fileManager.packageAttr};
terminalCommand = config.repo.terminal.primary.command;
outputs = lib.mapAttrs (
_: display:
@@ -65,13 +61,6 @@ in
) osConfig.meta.machine.displays;
in
{
assertions = [
{
assertion = fileManagerPackage != null;
message = "Unknown file manager package `${lib.showAttrPath repo.desktop.fileManager.packagePath}`.";
}
];
home.sessionVariables.NIXOS_OZONE_WL = "1";
dconf.settings = {
+9 -1
View File
@@ -1,4 +1,7 @@
{ inputs, ... }:
{ inputs, config, ... }:
let
account = config.repo.account;
in
{
flake.modules.nixos.nix =
{ ... }:
@@ -53,5 +56,10 @@
enable = true;
enableTelevisionIntegration = true;
};
programs.nh = {
enable = true;
flake = account.nixosConfigurationPath;
};
};
}
@@ -7,9 +7,8 @@ let
account = repo.account;
in
{
flake.modules.homeManager.bitwarden =
flake.modules.homeManager.passwords =
{
config,
pkgs,
...
}:
+85 -1
View File
@@ -4,9 +4,93 @@
}:
let
repo = config.repo;
account = repo.account;
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,
...
+1 -1
View File
@@ -8,7 +8,7 @@ let
);
in
{
flake.modules.nixos.ssh-agent-auth = {
flake.modules.nixos.sudo-ssh-agent-auth = {
security.pam = {
rssh.enable = true;
services.sudo.rssh = true;
@@ -1,6 +1,6 @@
{ ... }:
{
flake.modules.nixos.standard-boot =
flake.modules.nixos.systemd-boot =
{ config, pkgs, ... }:
{
boot = {
-27
View File
@@ -2,31 +2,6 @@
let
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 =
{
desktopId,
@@ -40,8 +15,6 @@ let
{
imports = [ terminalModule ];
options.repo.terminal.primary = mkPrimaryTerminalOption lib;
config = {
repo.terminal.primary = {
inherit
+2 -2
View File
@@ -27,12 +27,12 @@
desktop = {
browser = {
command = "vivaldi";
packagePath = [ "vivaldi" ];
packageAttr = "vivaldi";
};
fileManager = {
command = "nautilus";
packagePath = [ "nautilus" ];
packageAttr = "nautilus";
};
};
+1 -1
View File
@@ -25,7 +25,7 @@ in
nixosModules.openssh
nixosModules.caddy
nixosModules.server-firewall
nixosModules.ssh-agent-auth
nixosModules.sudo-ssh-agent-auth
nixosModules.vaultwarden
nixosModules.radicale
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 (
{ ... }:
{
@@ -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
{
options.repo = {
@@ -176,8 +227,7 @@ in
};
desktop = lib.mkOption {
type = lib.types.raw;
default = { };
type = desktopType;
};
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
inputs.home-manager.nixosModules.home-manager
nixosModules.nix
nixosModules.region-nl
nixosModules.locale-nl
nixosModules.sops-password
];
@@ -22,6 +22,7 @@ in
backupFileExtension = "bak";
extraSpecialArgs = { inherit inputs; };
sharedModules = [
hmModules.repo-schema
hmModules.syncthing
hmModules.shell
hmModules.neovim
+5 -7
View File
@@ -13,13 +13,13 @@ in
nixosModules.bluetooth
nixosModules.flatpak
nixosModules.fonts
nixosModules.networking
nixosModules.network-manager
nixosModules.niri
nixosModules.plymouth
nixosModules.printing
nixosModules.sddm
nixosModules.sops-admin-key-file
nixosModules.standard-boot
nixosModules.systemd-boot
nixosModules.theme
nixosModules.ai
];
@@ -37,16 +37,15 @@ in
flake.modules.homeManager.workstation-base = {
imports = [
homeModules.ai
homeModules.bitwarden
homeModules.passwords
homeModules.clipboard
homeModules.dev-tools
homeModules.desktop-defaults
homeModules.email
homeModules.local-apps
homeModules.mpv
homeModules.nh
homeModules.niri
homeModules.nix
homeModules.pim
homeModules.calendar-tasks
homeModules.podman
homeModules.qbittorrent-client
homeModules.sops
@@ -56,7 +55,6 @@ in
homeModules.terminal-kitty
homeModules.theme
homeModules.vicinae
homeModules.xdg
homeModules.noctalia
];
};