Files
homelab/lib/container.nix.template
2025-10-24 19:48:09 +02:00

61 lines
1.9 KiB
Plaintext

{ pkgs, containersMapping, ... }:
let
infra = import ../lib/constants.nix;
in
{
# OPTIONAL int cores: number of CPU (default = 1)
cores = 2;
# OPTIONAL int memory: RAM memory (default 512)
memory = 512;
# OPTIONAL string disk: disk space (default "4G") - beware, NixOS is greedy
disk = "4G";
# OPTIONAL string swap: swap space (default null)
swap = null;
# OPTIONAL list of int tcp_ports: TCP ports to open (default [])
tcp_ports = [ 80 ];
# OPTIONAL list of int udp_ports: UDP ports to open (default [])
udp_ports = [ ];
# OPTIONAL submodule services: services to be passed to the NixOS Module (default {})
services = {
nginx.enable = true;
};
# OPTIONAL list of pkgs other_packages: packages to add to eenvironment.systemPackages (default [])
other_packages = [ pkgs.hello ];
# OPTIONAL submodule etc: files contents to pass to eenvironment.etc
etc."alloy/log-myservice.alloy" = ''
# logger_ip = ${infra.build_ip containersMapping.grafana}
# prometheus = ${infra.build_ip containersMapping.prometheus}
'';
# OPTIONAL bool logging.enable: whether to enable the Alloy configuration (=> Loki)
# Need further configuration in etc."alloy/log-myservice.alloy"
logging.enable = true;
# OPTIONAL bool logging.metrics.enable: whether to enable the Alloy metrics configuration (=> Prometheus)
logging.metrics.enable = true;
# OPTIONAL string template: template file to use (default defined in infra/constants.nix)
template = null;
# OPTIONAL bool unprivileged: whether the container should be unprivileged (default true)
unprivileged = true;
# OPTIONAL string tags: ';'-separated tags, appended to "terraform" (default empty)
tags = "";
# OPTIONAL list of paths additional_tf_modules: list of modules to merge into the tf ressource module (default [])
# Not implemented
additional_tf_modules = [];
# OPTIONAL bool exposed: whether this host should be exposed by the reverse proxy.
exposed = false;
}