add wings package and module
This commit is contained in:
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# Ignore build outputs from performing a nix-build or `nix build` command
|
||||
result
|
||||
result-*
|
||||
|
||||
# Ignore automatically generated direnv output
|
||||
.direnv
|
||||
61
flake.lock
generated
Normal file
61
flake.lock
generated
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1769461804,
|
||||
"narHash": "sha256-msG8SU5WsBUfVVa/9RPLaymvi5bI8edTavbIq3vRlhI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "bfc1b8a4574108ceef22f02bafcf6611380c100d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
19
flake.nix
Normal file
19
flake.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
description = "Pterodactyl Wings for NixOS";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-linux"] (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
packages.wings = pkgs.callPackage ./pkgs/wings { };
|
||||
nixosModules.wings = import ./modules/wings { };
|
||||
}
|
||||
);
|
||||
}
|
||||
42
modules/wings/default.nix
Normal file
42
modules/wings/default.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.services.wings;
|
||||
wings = cfg.package or pkgs.wings;
|
||||
in
|
||||
{
|
||||
options.services.wings = {
|
||||
enable = lib.mkEnableOption "Enable Pterodactyl Wings";
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = null;
|
||||
description = "Package to use for Wings daemon";
|
||||
};
|
||||
configFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/etc/pterodactyl/config.yml";
|
||||
description = "Path to Wings configuration";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
virtualisation.docker.enable = true;
|
||||
|
||||
systemd.services.wings = {
|
||||
description = "Pterodactyl Wings";
|
||||
after = [ "docker.service" ];
|
||||
requires = [ "docker.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${wings}/bin/wings --config ${cfg.configFile}";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 5;
|
||||
DynamicUser = true;
|
||||
StateDirectory = "wings";
|
||||
BindPaths = [ "/var/run/docker.sock" ];
|
||||
LimitNOFILE = 1048576;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
37
pkgs/wings/default.nix
Normal file
37
pkgs/wings/default.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{ lib, stdenv, buildGoModule, fetchFromGitHub }:
|
||||
|
||||
let
|
||||
version = "1.12.1";
|
||||
in
|
||||
buildGoModule rec {
|
||||
pname = "pterodactyl-wings";
|
||||
inherit version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "pterodactyl";
|
||||
repo = "wings";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-VfUGm7uJwEo6Xl274KL3SsSOct4kix230gIF2QNdviE=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-BtATik0egFk73SNhawbGnbuzjoZioGFWeA4gZOaofTI=";
|
||||
|
||||
# CGO отключаем через buildFlags
|
||||
buildFlags = ["CGO_ENABLED=0"];
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X github.com/pterodactyl/wings/system.Version=${version}"
|
||||
];
|
||||
|
||||
subPackages = [ "." ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Daemon for Pterodactyl panel to manage servers";
|
||||
homepage = "https://pterodactyl.io";
|
||||
license = licenses.mit;
|
||||
maintainers = [ ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user