move stuff
This commit is contained in:
45
modules/nixos/services/netbootxyz/default.nix
Normal file
45
modules/nixos/services/netbootxyz/default.nix
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.${namespace}.services.netbootxyz;
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
# Open firewall for netbootxyz if enabled
|
||||
networking.firewall = mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [
|
||||
cfg.webPort
|
||||
cfg.assetPort
|
||||
cfg.tftpPort
|
||||
];
|
||||
allowedUDPPorts = [
|
||||
cfg.webPort
|
||||
cfg.assetPort
|
||||
cfg.tftpPort
|
||||
];
|
||||
};
|
||||
|
||||
virtualisation.oci-containers = {
|
||||
containers.netbootxyz = {
|
||||
autoStart = true;
|
||||
image = "ghcr.io/netbootxyz/netbootxyz:latest";
|
||||
ports = [
|
||||
"${toString cfg.webPort}:3000"
|
||||
"${toString cfg.assetPort}:80"
|
||||
"${toString cfg.tftpPort}:69"
|
||||
];
|
||||
volumes = [
|
||||
"${cfg.dataDir}:/config"
|
||||
"${cfg.assetDir}:/assets"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
43
modules/nixos/services/netbootxyz/options.nix
Normal file
43
modules/nixos/services/netbootxyz/options.nix
Normal file
@@ -0,0 +1,43 @@
|
||||
{ lib, namespace, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.${namespace}.services.netbootxyz = {
|
||||
enable = mkEnableOption "netbootxyz network boot service";
|
||||
|
||||
webPort = mkOption {
|
||||
type = types.port;
|
||||
default = 4000;
|
||||
description = "HTTP port for netbootxyz";
|
||||
};
|
||||
|
||||
assetPort = mkOption {
|
||||
type = types.port;
|
||||
default = 4001;
|
||||
description = "NGINX server for hosting assets.";
|
||||
};
|
||||
|
||||
tftpPort = mkOption {
|
||||
type = types.port;
|
||||
default = 69;
|
||||
description = "HTTPS port for netbootxyz";
|
||||
};
|
||||
|
||||
openFirewall = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to open firewall for netbootxyz";
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
default = "/media/nas/main/nix-app-data/netbootxyz";
|
||||
description = "Data directory for netbootxyz";
|
||||
};
|
||||
|
||||
assetDir = mkOption {
|
||||
type = types.str;
|
||||
default = "/media/nas/main/isos";
|
||||
description = "Asset directory for netbootxyz";
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user