test automatical inculstion in motd
This commit is contained in:
@@ -38,7 +38,10 @@ in {
|
|||||||
};
|
};
|
||||||
motd = lib.mkOption {
|
motd = lib.mkOption {
|
||||||
type = lib.types.nullOr lib.types.str;
|
type = lib.types.nullOr lib.types.str;
|
||||||
default = "velocity";
|
default =
|
||||||
|
if cfg.enable
|
||||||
|
then "velocity"
|
||||||
|
else null;
|
||||||
};
|
};
|
||||||
backup_repo = lib.mkOption {
|
backup_repo = lib.mkOption {
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
{ pkgs, config, lib, ... }:
|
{
|
||||||
|
pkgs,
|
||||||
let
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
service = "audiobookshelf";
|
service = "audiobookshelf";
|
||||||
cfg = config.homelab.${service};
|
cfg = config.homelab.${service};
|
||||||
sec = config.sops.secrets;
|
sec = config.sops.secrets;
|
||||||
homelab = config.homelab;
|
homelab = config.homelab;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options.homelab.${service} = {
|
options.homelab.${service} = {
|
||||||
enable = lib.mkEnableOption "enables ${service}";
|
enable = lib.mkEnableOption "enables ${service}";
|
||||||
|
|
||||||
@@ -38,12 +40,14 @@ in
|
|||||||
};
|
};
|
||||||
motd = lib.mkOption {
|
motd = lib.mkOption {
|
||||||
type = lib.types.nullOr lib.types.str;
|
type = lib.types.nullOr lib.types.str;
|
||||||
default = service;
|
default =
|
||||||
|
if cfg.enable
|
||||||
|
then service
|
||||||
|
else null;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
# declare ${service} group
|
# declare ${service} group
|
||||||
users.groups.${service} = {gid = lib.mkForce cfg.ids;};
|
users.groups.${service} = {gid = lib.mkForce cfg.ids;};
|
||||||
|
|
||||||
@@ -90,12 +94,15 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
# add to glance public service
|
# add to glance public service
|
||||||
homelab.glance.links.mediastack = [{
|
homelab.glance.links.mediastack = [
|
||||||
|
{
|
||||||
title = service;
|
title = service;
|
||||||
url = "https://abs.${homelab.base_domain}";
|
url = "https://abs.${homelab.base_domain}";
|
||||||
error-url = "http://${homelab.host_ip}:${toString cfg.port}";
|
error-url = "http://${homelab.host_ip}:${toString cfg.port}";
|
||||||
check-url = "http://${homelab.host_ip}:${toString cfg.port}";
|
check-url = "http://${homelab.host_ip}:${toString cfg.port}";
|
||||||
icon = "di:${service}"; }];
|
icon = "di:${service}";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
# add to backups
|
# add to backups
|
||||||
homelab.backups.baks = {
|
homelab.backups.baks = {
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ in {
|
|||||||
|
|
||||||
# --- gameservers ---
|
# --- gameservers ---
|
||||||
echo -e "''${headings}gameservers:''${reset}"
|
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)
|
status=$(systemctl is-active $service 2>/dev/null)
|
||||||
if [ "$status" = "active" ]; then
|
if [ "$status" = "active" ]; then
|
||||||
printf "%-32s%s\n" " ''${active}[$service]''${reset}" "running"
|
printf "%-32s%s\n" " ''${active}[$service]''${reset}" "running"
|
||||||
|
|||||||
Reference in New Issue
Block a user