This commit is contained in:
mjallen18
2025-08-25 21:33:42 -05:00
parent 281bb7cb55
commit 3bbd0d4432
2 changed files with 28 additions and 28 deletions

View File

@@ -15,43 +15,31 @@ in
# Open firewall for netbootxyz if enabled # Open firewall for netbootxyz if enabled
networking.firewall = mkIf cfg.openFirewall { networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [ allowedTCPPorts = [
cfg.httpPort cfg.webPort
cfg.httpsPort cfg.assetPort
cfg.tftpPort
]; ];
allowedUDPPorts = [ allowedUDPPorts = [
cfg.httpPort cfg.webPort
cfg.httpsPort cfg.assetPort
cfg.tftpPort
]; ];
}; };
# Create data directory
systemd.tmpfiles.rules = [
"d ${cfg.dataDir} 0755 root root -"
];
# Configure netbootxyz as a container service
virtualisation.oci-containers = { virtualisation.oci-containers = {
backend = "podman";
containers.netbootxyz = { containers.netbootxyz = {
autoStart = true;
image = "ghcr.io/netbootxyz/netbootxyz:latest"; image = "ghcr.io/netbootxyz/netbootxyz:latest";
ports = [ ports = [
"${toString cfg.httpPort}:3000" "${toString cfg.webPort}:3000"
"${toString cfg.httpsPort}:3001" "${toString cfg.assetPort}:80"
"${toString cfg.tftpPort}:69"
]; ];
volumes = [ volumes = [
"${cfg.dataDir}:/app/src/config" "${cfg.dataDir}:/config"
]; "${cfg.assetDir}:/assets"
environment = {
MENU_VERSION = "2.0.76";
PORT_RANGE = "30000:30010";
};
extraOptions = [
"--restart=unless-stopped"
]; ];
}; };
}; };
# Enable podman for oci-containers
virtualisation.podman.enable = true;
}; };
} }

View File

@@ -4,15 +4,21 @@ with lib;
options.${namespace}.services.netbootxyz = { options.${namespace}.services.netbootxyz = {
enable = mkEnableOption "netbootxyz network boot service"; enable = mkEnableOption "netbootxyz network boot service";
httpPort = mkOption { webPort = mkOption {
type = types.port; type = types.port;
default = 4000; default = 4000;
description = "HTTP port for netbootxyz"; description = "HTTP port for netbootxyz";
}; };
httpsPort = mkOption { assetPort = mkOption {
type = types.port; type = types.port;
default = 4080; default = 4001;
description = "NGINX server for hosting assets.";
};
tftpPort = mkOption {
type = types.port;
default = 69;
description = "HTTPS port for netbootxyz"; description = "HTTPS port for netbootxyz";
}; };
@@ -24,8 +30,14 @@ with lib;
dataDir = mkOption { dataDir = mkOption {
type = types.str; type = types.str;
default = "/var/lib/netbootxyz"; default = "/media/nas/main/nix-app-data/netbootxyz";
description = "Data directory for netbootxyz"; description = "Data directory for netbootxyz";
}; };
assetDir = mkOption {
type = types.str;
default = "/media/nas/main/isos";
description = "Asset directory for netbootxyz";
};
}; };
} }