mkModule various

This commit is contained in:
mjallen18
2025-12-17 12:52:42 -06:00
parent 50345adeb5
commit 96ce0001c5
16 changed files with 462 additions and 636 deletions

View File

@@ -6,22 +6,24 @@
}:
with lib;
let
cfg = config.${namespace}.services.lubelogger;
in
{
imports = [ ./options.nix ];
name = "lubelogger";
cfg = config.${namespace}.services.${name};
config = mkIf cfg.enable {
lubeloggerConfig = lib.${namespace}.mkModule {
inherit config name;
description = "lubelogger";
options = { };
moduleConfig = {
virtualisation.oci-containers.containers.lubelogger = {
autoStart = true;
image = "ghcr.io/hargata/lubelogger";
ports = [ "${toString cfg.port}:8080" ];
volumes = [
"/media/nas/main/nix-app-data/lubelogger:/App/data"
"/media/nas/main/nix-app-data/lubelogger/keys:/root/.aspnet/DataProtection-Keys"
"${cfg.configDir}/lubelogger:/App/data"
"${cfg.configDir}/lubelogger/keys:/root/.aspnet/DataProtection-Keys"
];
environmentFiles = [
"/media/nas/main/nix-app-data/lubelogger/lubelogger.env"
"${cfg.configDir}/lubelogger/lubelogger.env"
];
environment = {
PUID = toString config.users.users.nix-apps.uid;
@@ -29,11 +31,9 @@ in
TZ = "America/Chicago";
};
};
# Open firewall for lubelogger if enabled
networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.port ];
allowedUDPPorts = [ cfg.port ];
};
};
in
{
imports = [ lubeloggerConfig ];
}

View File

@@ -1,19 +0,0 @@
{ lib, namespace, ... }:
with lib;
{
options.${namespace}.services.lubelogger = {
enable = mkEnableOption "enable lubelogger";
port = mkOption {
type = types.port;
default = 6754;
description = "Port for lubelogger web interface";
};
openFirewall = mkOption {
type = types.bool;
default = true;
description = "Whether to open firewall for lubelogger";
};
};
}