-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
flake.nix
71 lines (57 loc) · 1.69 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
description = "PyroPanel";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs { inherit system; };
pyrodactylPath = builtins.toString ./.;
in {
devShell = pkgs.mkShell {
buildInputs = [
pkgs.php
pkgs.phpPackages.composer
pkgs.redis
pkgs.nginx
pkgs.docker
pkgs.docker-compose
pkgs.mariadb
pkgs.nodejs_20
pkgs.tmux
];
shellHook = let
dataDir = "./data";
in ''
echo "Starting Redis in the dev shell..."
# Start Redis in the background
# These damn variables causing all sorts of issues when not here
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
redis-server --daemonize yes
echo "Redis is running!"
echo "Resetting MariaDB Data"
# Delete Maria Folders
echo "Delete maria Folders"
rm -fR $(pwd)/nix/docker/maria/mariadb_data
# Create Maria Folders
echo "Create maria Folders"
mkdir $(pwd)/nix/docker/maria/mariadb_data
echo "Starting Pyrodactyl"
bash ./nix/buildsteps.sh
# Define cleanup function to stop services
cleanup() {
echo "Stopping Redis..."
pkill redis-server
echo "Stopping mariadb-docker..."
docker-compose --project-directory ./nix/docker/maria/ down
echo "Stopping Pterodactyl wings..."
docker-compose --project-directory ./nix/docker/wings/ down
}
# Register cleanup on shell exit
trap cleanup EXIT
'';
};
});
}