roles: Base structure for all roles

This commit is contained in:
2025-07-06 12:55:29 -07:00
parent 4b4d2789fe
commit 94debbce6a
9 changed files with 73 additions and 3 deletions

View File

@@ -27,7 +27,7 @@ in {
};
};
config = mkIf config.dbserver-mariadb.enable {
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
cfg.dbPackage
cfg.ansibleLibPackage

View File

@@ -26,7 +26,7 @@ in {
};
};
config = mkIf config.dbserver-mariadb.enable {
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
cfg.dbPackage
cfg.ansibleLibPackage

12
roles/logserver.nix Normal file
View File

@@ -0,0 +1,12 @@
# Module: roles/logserver
# Enables the usage of a logserver with traefik, loki, and prometheus
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.logserver;
in {
options.logserver = { enable = mkEnableOption "Enables logserver role"; };
config = mkIf cfg.enable { };
}

View File

@@ -0,0 +1,14 @@
# Module: roles/mailserver
# Enables a mail server using Stalwart
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.mailserver;
in {
options.mailserver = {
enable = mkEnableOption "Enables dbserver-mariadb role";
};
config = mkIf cfg.enable { imports = [ ../apps/stalwart.nix ]; };
}

View File

@@ -0,0 +1,16 @@
# Module: roles/monitorserver
# Enables server monitoring using HealthChecks and Uptime Kuma
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.monitorserver;
in {
options.monitorserver = {
enable = mkEnableOption "Enables monitorserver role";
};
config = mkIf cfg.enable {
imports = [ ../apps/healthchecks.nix ../apps/uptime-kuma.nix ];
};
}

View File

@@ -24,7 +24,7 @@ in {
};
};
config = mkIf config.printserver.enable {
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ cups gutenprint ];
services.avahi = {

View File

@@ -1,4 +1,5 @@
# roles/roles.nix
# Entrypoint for all roles files
{ lib, pkgs, options, ... }: {
imports = [
./dbserver-mariadb.nix
@@ -12,6 +13,7 @@
dbserver-mariadb.enable = lib.mkDefault false;
dbserver-postgresql.enable = lib.mkDefault false;
logserver.enable = lib.mkDefault false;
mailserver.enable = lib.mkDefault false;
monitorserver.enable = lib.mkDefault false;
printserver.enable = lib.mkDefault false;

View File

@@ -0,0 +1,14 @@
# Module: roles/syncthingserver
# Enables a syncthing server
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.syncthingserver;
in {
options.syncthingserver = {
enable = mkEnableOption "Enables syncthingserver role";
};
config = mkIf cfg.enable { };
}

View File

@@ -0,0 +1,12 @@
# Module: roles/webserver
# Enables the usage of a webserver with traefik and web services
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.webserver;
in {
options.webserver = { enable = mkEnableOption "Enables webserver role"; };
config = mkIf cfg.enable { };
}