Skip to content

Commit c04d78d

Browse files
committed
add installation guide for nixos
1 parent 639ce1f commit c04d78d

File tree

4 files changed

+170
-2
lines changed

4 files changed

+170
-2
lines changed

content/docs/guides/panel-installation/meta.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"pages": [
44
"debian",
55
"centos7",
6-
"centos8"
6+
"centos8",
7+
"nixos"
78
]
89
}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
title: NixOS
3+
---
4+
5+
6+
7+
This guide provides instructions for installing Pterodactyl Panel on NixOS.
8+
9+
## Generating secrets
10+
11+
Before configuring the service, we need to generate a new application encryption key.
12+
13+
```bash
14+
echo "base64:$(openssl rand -base64 32)"
15+
```
16+
17+
<Callout type="error">
18+
Back up the encryption key. It is used as an encryption key for all data that needs to be stored securely (e.g. API keys).
19+
Store it somewhere safe - not just on your server. If you lose it, all encrypted data is irrecoverable, even with database backups.
20+
21+
Copy the key generated and save it somewhere secure:
22+
- A password manager
23+
- An encrypted file on your local machine
24+
- A secure USB drive
25+
- A trusted cloud vault
26+
27+
Do not keep it only on the server. If you lose this key, your encrypted data is permanently unrecoverable.
28+
</Callout>
29+
30+
You would also need to generate a salt key, which is used for providing additional security to encrypted data as a way to make it fully random each time. It can be anything from a randomly generated string to an UUID.
31+
32+
```bash
33+
openssl rand -hex 16
34+
```
35+
36+
## Configuration
37+
38+
Now we can enable the service, add the following code to your `configuration.nix`.
39+
40+
```nix
41+
{
42+
services.pterodactyl.panel = {
43+
enable = true;
44+
app = {
45+
url = "https://panel.example.com";
46+
# Using agenix, sops-nix or something else
47+
keyFile = "/path/to/app_key";
48+
# Direct (not recommended)
49+
# key = "";
50+
};
51+
52+
hashids = {
53+
saltFile = "/path/to/hashids_salt";
54+
# salt = "";
55+
};
56+
};
57+
}
58+
```
59+
60+
If you want the panel to be accessible to the public, make sure to open Nginx's port by adding this in your `configuration.nix`.
61+
62+
```nix
63+
{
64+
networking.firewall.allowedTCPPorts = [80 443];
65+
}
66+
```
67+
68+
### Using Caddy with FrankenPHP
69+
70+
Using Caddy with FrankenPHP is much performant and better than Nginx and PHP-FPM. Here is an example configuration to put in your `configuration.nix`.
71+
72+
```nix
73+
{
74+
services.caddy = {
75+
enable = true;
76+
package = pkgs.frankenphp.override {
77+
php = config.services.pterodactyl.panel.phpPackage;
78+
};
79+
80+
virtualHosts = {
81+
"panel.example.com".extraConfig = ''
82+
root * ${config.services.pterodactyl.panel.package}/public
83+
php_server
84+
'';
85+
};
86+
};
87+
88+
services.pterodactyl.panel = {
89+
enable = true;
90+
enableNginx = false;
91+
user = "caddy";
92+
group = "caddy";
93+
database.user = "caddy";
94+
app.url = "https://panel.example.com";
95+
};
96+
97+
users.users.caddy.extraGroups = ["redis"];
98+
}
99+
```
100+
101+
## Add The First User
102+
103+
You'll then need to create an administrative user so that you can log into the panel. To do so, run the command below.
104+
At this time passwords **must** meet the following requirements: 8 characters, mixed case, at least one number.
105+
106+
```bash
107+
pterodactyl-cli p:user:make
108+
```

content/docs/guides/wings-installation/meta.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"title": "Wings Installation",
33
"pages": [
44
"centos7",
5-
"centos8"
5+
"centos8",
6+
"nixos"
67
]
78
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: NixOS
3+
---
4+
5+
6+
7+
This guide provides instructions for installing Pterodactyl Wings on NixOS.
8+
9+
## Configuration
10+
11+
Make sure to firstly create the node on the panel in order to configure wings. To enable the service, add the following code to your `configuration.nix`:
12+
13+
```nix
14+
{
15+
services.pterodactyl.wings = {
16+
enable = true;
17+
uuid = "your-node-uuid";
18+
remote = "https://panel.example.com";
19+
# Using agenix, sops-nix or something else
20+
tokenIdFile = "/path/to/token_id";
21+
# Direct (not recommended)
22+
# tokenId = "";
23+
tokenFile = "/path/to/token";
24+
# tokenFile = "";
25+
};
26+
}
27+
```
28+
29+
If you want wings to be accessible to the public, make sure to open the API and SFTP ports by adding this in your `configuration.nix`:
30+
31+
```nix
32+
{
33+
services.pterodactyl.wings = {
34+
openFirewall = true;
35+
};
36+
}
37+
```
38+
39+
### Opening container ports
40+
41+
Unfortunately this cannot be done automatically. If you have made a lot of ports as a range,
42+
you can open them with `networking.firewall.allowedTCPPortRanges` and `networking.firewall.allowedUDPPortRanges` in your `configuration.nix`:
43+
44+
```nix
45+
{
46+
networking.firewall = {
47+
enable = true;
48+
allowedTCPPortRanges = [
49+
{ from = 25565; to = 25600; }
50+
{ from = 3000; to = 3100; }
51+
];
52+
allowedUDPPortRanges = [
53+
{ from = 25565; to = 25600; }
54+
{ from = 3000; to = 3100; }
55+
];
56+
};
57+
}
58+
```

0 commit comments

Comments
 (0)