switched to flakes and built out modularity

This commit is contained in:
2026-02-11 13:45:21 -05:00
parent 5f6a53c15f
commit c5a99c5b75
15 changed files with 489 additions and 151 deletions

View File

@@ -0,0 +1,22 @@
{ config, lib, ... }:
let
cfg = config.control.gitea;
in
{
config = lib.mkIf cfg.enable {
services.gitea = {
enable = true;
settings = {
server = {
HTTP_PORT = 3000;
DOMAIN = "gitea.local";
ROOT_URL = "http://gitea.local:3000/";
};
service.DISABLE_REGISTRATION = true;
};
};
networking.firewall.allowedTCPPorts = [ 3000 ];
};
}

View File

@@ -0,0 +1,27 @@
{ config, lib, ... }:
let
cfg = config.control.homeassistant;
in
{
config = lib.mkIf cfg.enable {
services.home-assistant = {
enable = true;
extraComponents = [
"analytics"
"google_translate"
"met"
"radio_browser"
"shopping_list"
"isal"
];
config = {
default_config = {};
};
};
networking.firewall.allowedTCPPorts = [ 8123 ];
};
}

View File

@@ -0,0 +1,12 @@
{ config, lib, ... }:
let
cfg = config.control.jellyfin;
in
{
config = lib.mkIf cfg.enable {
services.jellyfin.enable = true;
networking.firewall.allowedTCPPorts = [ 8096 ];
};
}

21
modules/services/k3s.nix Normal file
View File

@@ -0,0 +1,21 @@
{ config, lib, ... }:
let
cfg = config.control.k3s;
in
{
config = lib.mkIf cfg.enable {
services.k3s = {
enable = true;
role = cfg.role;
clusterInit = cfg.clusterInit;
serverAddr = cfg.serverAddr;
tokenFile = cfg.tokenFile;
};
networking.firewall = lib.mkIf cfg.openFirewall {
allowedTCPPorts = [ 6443 2379 2380 ];
allowedUDPPorts = [ 8472 ];
};
};
}

View File

@@ -0,0 +1,20 @@
{ config, lib, ... }:
let
cfg = config.control.navidrome;
in
{
config = lib.mkIf cfg.enable {
services.navidrome = {
enable = true;
settings = {
Address = "0.0.0.0";
Port = cfg.port;
MusicFolder = cfg.musicFolder;
DataFolder = cfg.dataFolder;
};
};
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [ cfg.port ];
};
}

View File

@@ -0,0 +1,31 @@
{ config, lib, ... }:
let
cfg = config.control.nextcloud;
in
{
assertions = [
{
assertion = (!cfg.enable) || (cfg.adminPassFile != null);
message = "control.nextcloud.adminPassFile must be set when Nextcloud is enabled.";
}
];
config = lib.mkIf cfg.enable {
services.nextcloud = {
enable = true;
hostName = cfg.hostName;
https = false;
config = {
dbtype = "sqlite";
adminuser = "admin";
adminpassFile = cfg.adminPassFile;
};
settings = {
trusted_domains = [ cfg.hostName ];
};
};
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [ 80 443 ];
};
}

View File

@@ -0,0 +1,20 @@
{ config, lib, ... }:
let
cfg = config.control.vaultwarden;
in
{
config = lib.mkIf cfg.enable {
services.vaultwarden = {
enable = true;
config = {
DOMAIN = cfg.domain;
ROCKET_ADDRESS = "0.0.0.0";
ROCKET_PORT = cfg.port;
SIGNUPS_ALLOWED = false;
};
};
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [ cfg.port ];
};
}