switched to flakes and built out modularity
This commit is contained in:
22
modules/services/gitea.nix
Normal file
22
modules/services/gitea.nix
Normal 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 ];
|
||||
};
|
||||
}
|
||||
27
modules/services/homeassistant.nix
Normal file
27
modules/services/homeassistant.nix
Normal 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 ];
|
||||
};
|
||||
}
|
||||
12
modules/services/jellyfin.nix
Normal file
12
modules/services/jellyfin.nix
Normal 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
21
modules/services/k3s.nix
Normal 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 ];
|
||||
};
|
||||
};
|
||||
}
|
||||
20
modules/services/navidrome.nix
Normal file
20
modules/services/navidrome.nix
Normal 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 ];
|
||||
};
|
||||
}
|
||||
31
modules/services/nextcloud.nix
Normal file
31
modules/services/nextcloud.nix
Normal 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 ];
|
||||
};
|
||||
}
|
||||
20
modules/services/vaultwarden.nix
Normal file
20
modules/services/vaultwarden.nix
Normal 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 ];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user