refactor!: restructure and document configuration
This commit is contained in:
parent
4a02e072a7
commit
f87f9995be
126 changed files with 957 additions and 590 deletions
10
hosts/wizdesk/services/home-manager/default.nix
Normal file
10
hosts/wizdesk/services/home-manager/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./gakuen-cosplay-api.nix
|
||||
./hydractify-bot.nix
|
||||
./openttd.nix
|
||||
./terraria.nix
|
||||
];
|
||||
}
|
16
hosts/wizdesk/services/home-manager/gakuen-cosplay-api.nix
Normal file
16
hosts/wizdesk/services/home-manager/gakuen-cosplay-api.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ gakuen-cosplay, pkgs, ... }:
|
||||
|
||||
{
|
||||
systemd.user.services.gakuen-cosplay-api = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Unit.Description = "Gakuen Cosplay API";
|
||||
|
||||
Service = {
|
||||
ExecStart = "${gakuen-cosplay.packages.${pkgs.system}.backend}/bin/cosplayer_submission";
|
||||
Restart = "on-failure";
|
||||
Type = "simple";
|
||||
WorkingDirectory = "/mnt/internal/shared/work/gakuen/projects/cosplayer_submission/packages/backend";
|
||||
};
|
||||
};
|
||||
}
|
17
hosts/wizdesk/services/home-manager/hydractify-bot.nix
Normal file
17
hosts/wizdesk/services/home-manager/hydractify-bot.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ hydractify-bot, pkgs, ... }:
|
||||
|
||||
{
|
||||
systemd.user.services.hydractify-bot = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Unit.Description = "Hydractify bot";
|
||||
Unit.After = "postgresql.service";
|
||||
|
||||
Service = {
|
||||
ExecStart = "${hydractify-bot.defaultPackage.${pkgs.system}}/bin/hydractify";
|
||||
Restart = "on-failure";
|
||||
Type = "simple";
|
||||
WorkingDirectory = "/mnt/internal/hydractify/GitHub/hydractify";
|
||||
};
|
||||
};
|
||||
}
|
53
hosts/wizdesk/services/home-manager/openttd.nix
Normal file
53
hosts/wizdesk/services/home-manager/openttd.nix
Normal file
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
openttd
|
||||
];
|
||||
|
||||
systemd.user.services.openttd = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Unit.Description = "OpenTTD Tmux server";
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.tmux}/bin/tmux -L openttd new -s OpenTTD -d '${pkgs.openttd}/bin/openttd -g /home/wizardlink/.local/share/openttd/save/hyfy.sav -D'";
|
||||
ExecStop = "${pkgs.tmux}/bin/tmux kill-session -t OpenTTD";
|
||||
Restart = "on-failure";
|
||||
Type = "forking";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.openttd-rcon = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Unit = {
|
||||
Description = "OpenTTD RCON Password set";
|
||||
After = [ "openttd.service" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.tmux}/bin/tmux -L openttd send-keys -t OpenTTD 'rcon_pw aaaa' Enter";
|
||||
Type = "oneshot";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.openttd-save = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Unit = {
|
||||
Description = "OpenTTD RCON Password set";
|
||||
After = [ "openttd.service" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.tmux}/bin/tmux -L openttd send-keys -t OpenTTD 'save hyfy' Enter";
|
||||
Type = "simple";
|
||||
Restart = "always";
|
||||
RestartSec = "1800s";
|
||||
};
|
||||
};
|
||||
}
|
17
hosts/wizdesk/services/home-manager/terraria.nix
Normal file
17
hosts/wizdesk/services/home-manager/terraria.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
systemd.user.services.terraria = {
|
||||
Install.WantedBy = [ "default.target" ];
|
||||
|
||||
Unit.Description = "Terraria TMUX Server";
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.tmux}/bin/tmux -L terraria new -s Terraria -d /etc/profiles/per-user/wizardlink/bin/fhs -c 'dotnet ./tModLoader.dll -server -config serverconfig.txt'";
|
||||
ExecStop = "${pkgs.tmux}/bin/tmux kill-session -t Terraria";
|
||||
Restart = "on-failure";
|
||||
Type = "forking";
|
||||
WorkingDirectory = "/mnt/ssd/SteamLibrary/steamapps/common/tModLoader";
|
||||
};
|
||||
};
|
||||
}
|
20
hosts/wizdesk/services/nixos/archi.nix
Normal file
20
hosts/wizdesk/services/nixos/archi.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
services.archisteamfarm = {
|
||||
enable = true;
|
||||
web-ui.enable = true;
|
||||
|
||||
bots.wizardlink = {
|
||||
enabled = true;
|
||||
username = "master1891891";
|
||||
|
||||
settings = {
|
||||
CustomGamePlayedWhileFarming = "In the fields";
|
||||
};
|
||||
};
|
||||
|
||||
bots.zak = {
|
||||
enabled = true;
|
||||
username = "matheuszak";
|
||||
};
|
||||
};
|
||||
}
|
57
hosts/wizdesk/services/nixos/caddy.nix
Normal file
57
hosts/wizdesk/services/nixos/caddy.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{ ... }:
|
||||
{
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
email = "contact@thewizard.link";
|
||||
|
||||
virtualHosts."thewizard.link".extraConfig = ''
|
||||
redir https://github.com/wizardlink/
|
||||
header Strict-Transport-Security "max-age=63072000; includeSubDomains"
|
||||
'';
|
||||
|
||||
virtualHosts."jellyfin.thewizard.link".extraConfig = ''
|
||||
encode gzip
|
||||
reverse_proxy 127.0.0.1:8096 {
|
||||
flush_interval -1
|
||||
}
|
||||
'';
|
||||
|
||||
virtualHosts."jellyseerr.thewizard.link".extraConfig = ''
|
||||
reverse_proxy http://127.0.0.1:5055
|
||||
'';
|
||||
|
||||
virtualHosts."foundry.thewizard.link".extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:30000 {
|
||||
flush_interval -1
|
||||
}
|
||||
'';
|
||||
|
||||
virtualHosts."git.thewizard.link".extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:3788
|
||||
'';
|
||||
|
||||
virtualHosts."files.thewizard.link".extraConfig = ''
|
||||
root * /srv/files
|
||||
file_server
|
||||
'';
|
||||
|
||||
virtualHosts."torrent.thewizard.link".extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:8144
|
||||
'';
|
||||
|
||||
virtualHosts."shoko.thewizard.link".extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:8111
|
||||
'';
|
||||
|
||||
virtualHosts."api.cosplay.thewizard.link".extraConfig = ''
|
||||
reverse_proxy 127.0.0.1:3000
|
||||
'';
|
||||
|
||||
virtualHosts."cosplay.thewizard.link".extraConfig = ''
|
||||
root * /srv/cosplay
|
||||
encode
|
||||
try_files {path} /index.html
|
||||
file_server
|
||||
'';
|
||||
};
|
||||
}
|
12
hosts/wizdesk/services/nixos/default.nix
Normal file
12
hosts/wizdesk/services/nixos/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./archi.nix
|
||||
./caddy.nix
|
||||
./forgejo.nix
|
||||
./jellyfin.nix
|
||||
./nix-serve.nix
|
||||
./postgresql.nix
|
||||
];
|
||||
}
|
26
hosts/wizdesk/services/nixos/forgejo.nix
Normal file
26
hosts/wizdesk/services/nixos/forgejo.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
services.forgejo = {
|
||||
enable = true;
|
||||
|
||||
lfs.enable = true;
|
||||
|
||||
settings = {
|
||||
server = {
|
||||
HTTP_PORT = 3788;
|
||||
LANDING_PAGE = "explore";
|
||||
ROOT_URL = "https://git.thewizard.link";
|
||||
};
|
||||
|
||||
ui = {
|
||||
# HACK: Unfortunately we need to manually put files in /var/lib/forgejo/custom/public/assets/css
|
||||
# so this will break in a new system.
|
||||
DEFAULT_THEME = "catppuccin-frappe-lavender";
|
||||
THEMES = "forgejo-auto,forgejo-light,forgejo-dark,gitea-auto,gitea-light,gitea-dark,forgejo-auto-deuteranopia-protanopia,forgejo-light-deuteranopia-protanopia,forgejo-dark-deuteranopia-protanopia,forgejo-auto-tritanopia,forgejo-light-tritanopia,forgejo-dark-tritanopia,catppuccin-latte-rosewater,catppuccin-latte-flamingo,catppuccin-latte-pink,catppuccin-latte-mauve,catppuccin-latte-red,catppuccin-latte-maroon,catppuccin-latte-peach,catppuccin-latte-yellow,catppuccin-latte-green,catppuccin-latte-teal,catppuccin-latte-sky,catppuccin-latte-sapphire,catppuccin-latte-blue,catppuccin-latte-lavender,catppuccin-frappe-rosewater,catppuccin-frappe-flamingo,catppuccin-frappe-pink,catppuccin-frappe-mauve,catppuccin-frappe-red,catppuccin-frappe-maroon,catppuccin-frappe-peach,catppuccin-frappe-yellow,catppuccin-frappe-green,catppuccin-frappe-teal,catppuccin-frappe-sky,catppuccin-frappe-sapphire,catppuccin-frappe-blue,catppuccin-frappe-lavender,catppuccin-macchiato-rosewater,catppuccin-macchiato-flamingo,catppuccin-macchiato-pink,catppuccin-macchiato-mauve,catppuccin-macchiato-red,catppuccin-macchiato-maroon,catppuccin-macchiato-peach,catppuccin-macchiato-yellow,catppuccin-macchiato-green,catppuccin-macchiato-teal,catppuccin-macchiato-sky,catppuccin-macchiato-sapphire,catppuccin-macchiato-blue,catppuccin-macchiato-lavender,catppuccin-mocha-rosewater,catppuccin-mocha-flamingo,catppuccin-mocha-pink,catppuccin-mocha-mauve,catppuccin-mocha-red,catppuccin-mocha-maroon,catppuccin-mocha-peach,catppuccin-mocha-yellow,catppuccin-mocha-green,catppuccin-mocha-teal,catppuccin-mocha-sky,catppuccin-mocha-sapphire,catppuccin-mocha-blue,catppuccin-mocha-lavender";
|
||||
};
|
||||
|
||||
service = {
|
||||
DISABLE_REGISTRATION = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
36
hosts/wizdesk/services/nixos/jellyfin.nix
Normal file
36
hosts/wizdesk/services/nixos/jellyfin.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
services.jellyfin = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
user = "wizardlink";
|
||||
package = pkgs.jellyfin.override {
|
||||
jellyfin-web = pkgs.jellyfin-web.overrideAttrs (
|
||||
final: prev: {
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
# Inject the skip intro button script.
|
||||
sed -i "s#</head>#<script src=\"configurationpage?name=skip-intro-button.js\"></script></head>#" dist/index.html
|
||||
|
||||
mkdir -p $out/share
|
||||
cp -a dist $out/share/jellyfin-web
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
services.jellyseerr = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
package = pkgs.jellyseerr.overrideAttrs (
|
||||
_final: _prev: {
|
||||
dontCheckForBrokenSymlinks = true;
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
9
hosts/wizdesk/services/nixos/nix-serve.nix
Normal file
9
hosts/wizdesk/services/nixos/nix-serve.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.nix-serve = {
|
||||
enable = true;
|
||||
port = 7373;
|
||||
secretKeyFile = "/etc/keys/nix-store-wizdesk-1";
|
||||
};
|
||||
}
|
13
hosts/wizdesk/services/nixos/postgresql.nix
Normal file
13
hosts/wizdesk/services/nixos/postgresql.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
|
||||
initialScript = pkgs.writeText "backend-initScript" ''
|
||||
CREATE ROLE wizardlink WITH LOGIN SUPERUSER PASSWORD 'wizardlink' CREATEDB CREATEROLE REPLICATION;
|
||||
CREATE DATABASE wizardlink;
|
||||
GRANT ALL PRIVILEGES ON DATABASE wizardlink TO wizardlink;
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue