test automatical inculstion in motd
This commit is contained in:
@@ -38,7 +38,10 @@ in {
|
||||
};
|
||||
motd = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = "velocity";
|
||||
default =
|
||||
if cfg.enable
|
||||
then "velocity"
|
||||
else null;
|
||||
};
|
||||
backup_repo = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
{ pkgs, config, lib, ... }:
|
||||
|
||||
let
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
service = "audiobookshelf";
|
||||
cfg = config.homelab.${service};
|
||||
sec = config.sops.secrets;
|
||||
homelab = config.homelab;
|
||||
in
|
||||
{
|
||||
in {
|
||||
options.homelab.${service} = {
|
||||
enable = lib.mkEnableOption "enables ${service}";
|
||||
|
||||
@@ -38,24 +40,26 @@ in
|
||||
};
|
||||
motd = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = service;
|
||||
default =
|
||||
if cfg.enable
|
||||
then service
|
||||
else null;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
# declare ${service} group
|
||||
users.groups.${service} = { gid = lib.mkForce cfg.ids; };
|
||||
users.groups.${service} = {gid = lib.mkForce cfg.ids;};
|
||||
|
||||
# declare ${service} user
|
||||
users.users.${service} = {
|
||||
description = "${service} server user";
|
||||
uid = lib.mkForce cfg.ids;
|
||||
isSystemUser = true;
|
||||
# home = cfg.data_dir;
|
||||
# home = cfg.data_dir;
|
||||
createHome = true;
|
||||
group = service;
|
||||
extraGroups = [ "media" ];
|
||||
extraGroups = ["media"];
|
||||
};
|
||||
|
||||
# enable the ${service} service
|
||||
@@ -64,7 +68,7 @@ in
|
||||
openFirewall = true;
|
||||
user = service;
|
||||
group = service;
|
||||
# dataDir = cfg.data_dir;
|
||||
# dataDir = cfg.data_dir;
|
||||
host = "0.0.0.0";
|
||||
port = cfg.port;
|
||||
};
|
||||
@@ -72,16 +76,16 @@ in
|
||||
# override umask to make permissions work out
|
||||
systemd.services.${service}.serviceConfig = {
|
||||
UMask = lib.mkForce "0007";
|
||||
# User = service;
|
||||
# Group = service;
|
||||
# User = service;
|
||||
# Group = service;
|
||||
};
|
||||
|
||||
# # open firewall
|
||||
# networking.firewall.allowedTCPPorts = [ cfg.port ];
|
||||
# # open firewall
|
||||
# networking.firewall.allowedTCPPorts = [ cfg.port ];
|
||||
|
||||
# add to caddy for reverse proxy
|
||||
services.caddy.virtualHosts."${cfg.url}" = {
|
||||
serverAliases = [ "abs.${homelab.public_domain}" ];
|
||||
serverAliases = ["abs.${homelab.public_domain}"];
|
||||
extraConfig = ''
|
||||
tls internal
|
||||
reverse_proxy 127.0.0.1:${toString cfg.port} {
|
||||
@@ -90,16 +94,19 @@ in
|
||||
};
|
||||
|
||||
# add to glance public service
|
||||
homelab.glance.links.mediastack = [{
|
||||
title = service;
|
||||
url = "https://abs.${homelab.base_domain}";
|
||||
error-url = "http://${homelab.host_ip}:${toString cfg.port}";
|
||||
check-url = "http://${homelab.host_ip}:${toString cfg.port}";
|
||||
icon = "di:${service}"; }];
|
||||
homelab.glance.links.mediastack = [
|
||||
{
|
||||
title = service;
|
||||
url = "https://abs.${homelab.base_domain}";
|
||||
error-url = "http://${homelab.host_ip}:${toString cfg.port}";
|
||||
check-url = "http://${homelab.host_ip}:${toString cfg.port}";
|
||||
icon = "di:${service}";
|
||||
}
|
||||
];
|
||||
|
||||
# add to backups
|
||||
homelab.backups.baks = {
|
||||
${service} = { paths = [ cfg.data_dir ]; };
|
||||
${service} = {paths = [cfg.data_dir];};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ in {
|
||||
|
||||
# --- gameservers ---
|
||||
echo -e "''${headings}gameservers:''${reset}"
|
||||
for service in velocity smp superflat bento cobblemon; do
|
||||
for service in velocity smp superflat bento; do
|
||||
status=$(systemctl is-active $service 2>/dev/null)
|
||||
if [ "$status" = "active" ]; then
|
||||
printf "%-32s%s\n" " ''${active}[$service]''${reset}" "running"
|
||||
|
||||
Reference in New Issue
Block a user