Watch
1
0
Fork
You've already forked pterodactyl-nixos
0

Initial commit

This commit is contained in:
fi 2026-11-14 19:00:27 +01:00
commit 93489cbe1a
Signed by: fi
SSH key fingerprint: SHA256:inADBPqGBCdCSM3hxqnGk9srEdSG0Zl5WzSzKjd7f34

View file

@ -0,0 +1,133 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkOption mkEnableOption mkPackageOption mkDefault mkIf types getExe;
cfg = config.services.pterodactyl-wings;
format = pkgs.formats.yaml { };
configFile = format.generate "wings-config.yml" cfg.settings;
configPath = "/etc/pterodactyl/config.yml";
in
{
options.services.pterodactyl-wings = {
enable = mkEnableOption "Pterodactyl Wings";
package = mkPackageOption pkgs "pterodactyl-wings" { };
openFirewall = mkEnableOption {
type = types.bool;
default = false;
};
tokenFile = mkOption {
type = types.pathWith {
inStore = false;
absolute = true;
};
};
settings = mkOption {
default = { };
type = types.submodule {
freeformType = format.type;
options = {
uuid = mkOption {
type = types.str;
};
token_id = mkOption {
type = types.str;
};
remote = mkOption {
type = types.str;
};
api = mkOption {
default = { };
type = types.submodule {
freeformType = format.type;
options = {
port = mkOption {
type = types.port;
default = 8080;
};
};
};
};
system = mkOption {
default = { };
type = types.submodule {
freeformType = format.type;
options = {
root_directory = mkOption {
type = types.path;
default = "/var/lib/pterodactyl-wings";
};
username = mkOption {
type = types.str;
default = "pterodactyl-wings";
};
sftp = mkOption {
default = { };
type = types.submodule {
freeformType = format.type;
options = {
bind_port = mkOption {
type = types.port;
default = 2022;
};
};
};
};
};
};
};
};
};
};
};
config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [
cfg.settings.api.port
cfg.settings.system.sftp.bind_port
];
virtualisation.docker.enable = true;
users = {
users.${cfg.settings.system.username} = {
isSystemUser = true;
group = cfg.settings.system.username;
};
groups.${cfg.settings.system.username} = { };
};
services.pterodactyl-wings.settings = {
debug = mkDefault false;
token = "file://${cfg.tokenFile}";
remote = mkIf config.services.pterodactyl-panel.enable (mkDefault config.services.pterodactyl-panel.appUrl);
ignore_panel_config_updates = mkDefault true;
api.ssl = {
enabled = true;
cert = "/var/lib/acme/gameserver.nekover.se/fullchain.pem";
key = "/var/lib/acme/gameserver.nekover.se/key.pem";
};
};
systemd.services.wings = {
description = "Pterodactyl Wings Daemon";
after = [ "docker.service" ];
requires = [ "docker.service" ];
partOf = [ "docker.service" ];
startLimitIntervalSec = 180;
startLimitBurst = 30;
serviceConfig = {
User = "root";
LimitNOFILE = 4096;
PIDFile = "/var/run/wings/daemon.pid";
ExecStartPre = "${pkgs.coreutils}/bin/install -D -m 0600 ${configFile} ${configPath}";
ExecStart = "${getExe cfg.package}";
Restart = "on-failure";
RestartSec = "5s";
};
wantedBy = [ "multi-user.target" ];
};
};
}