From aa9243ac6e5cee9be2d6c6c82f8ed5438ff80c4d Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Wed, 5 Mar 2025 16:36:24 -0300 Subject: [PATCH] feat: api.cosplay.thewizard.link & cosplay.thewizard.link --- flake.lock | 87 ++++++++++++++++--- flake.nix | 2 + specific/desktop/home-manager.nix | 1 + specific/desktop/services/caddy.nix | 11 +++ .../desktop/services/gakuen-cosplay-api.nix | 16 ++++ 5 files changed, 106 insertions(+), 11 deletions(-) create mode 100644 specific/desktop/services/gakuen-cosplay-api.nix diff --git a/flake.lock b/flake.lock index 5ab8402..4f8ddab 100644 --- a/flake.lock +++ b/flake.lock @@ -69,6 +69,25 @@ "type": "github" } }, + "gakuen-cosplay": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + }, + "locked": { + "lastModified": 1741202597, + "narHash": "sha256-5aqKb1BznEzPVHtg3J9yB5dOWl2qM9ZdS4ZXSWn20Ec=", + "ref": "refs/heads/main", + "rev": "3a305fff911393544f64a2f623f04c3cd7b6bc3f", + "revCount": 9, + "type": "git", + "url": "file:///mnt/internal/shared/work/gakuen/projects/cosplayer_submission" + }, + "original": { + "type": "git", + "url": "file:///mnt/internal/shared/work/gakuen/projects/cosplayer_submission" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -114,8 +133,8 @@ "hydractify-bot": { "inputs": { "naersk": "naersk", - "nixpkgs": "nixpkgs_2", - "utils": "utils" + "nixpkgs": "nixpkgs_3", + "utils": "utils_2" }, "locked": { "lastModified": 1736510643, @@ -199,9 +218,9 @@ "hyprlang": "hyprlang", "hyprutils": "hyprutils", "hyprwayland-scanner": "hyprwayland-scanner", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "pre-commit-hooks": "pre-commit-hooks", - "systems": "systems_2", + "systems": "systems_3", "xdph": "xdph" }, "locked": { @@ -392,7 +411,7 @@ }, "naersk": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1721727458, @@ -410,6 +429,18 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 0, + "narHash": "sha256-zON2GNBkzsIyALlOCFiEBcIjI4w38GYOb+P+R4S8Jsw=", + "path": "/nix/store/s1fbk6a410xn8vcaj54iqv22agyn0ria-source", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 0, "narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=", @@ -421,7 +452,7 @@ "type": "indirect" } }, - "nixpkgs_2": { + "nixpkgs_3": { "locked": { "lastModified": 1729850857, "narHash": "sha256-WvLXzNNnnw+qpFOmgaM3JUlNEH+T4s22b5i2oyyCpXE=", @@ -437,7 +468,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1739020877, "narHash": "sha256-mIvECo/NNdJJ/bXjNqIh8yeoSjVLAuDuTUzAo7dzs8Y=", @@ -453,7 +484,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1739736696, "narHash": "sha256-zON2GNBkzsIyALlOCFiEBcIjI4w38GYOb+P+R4S8Jsw=", @@ -495,10 +526,11 @@ "root": { "inputs": { "clipboard-sync": "clipboard-sync", + "gakuen-cosplay": "gakuen-cosplay", "home-manager": "home-manager", "hydractify-bot": "hydractify-bot", "hyprland": "hyprland", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_5", "spicetify-nix": "spicetify-nix" } }, @@ -507,7 +539,7 @@ "nixpkgs": [ "nixpkgs" ], - "systems": "systems_3" + "systems": "systems_4" }, "locked": { "lastModified": 1739679385, @@ -539,6 +571,21 @@ } }, "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { "locked": { "lastModified": 1689347949, "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", @@ -553,7 +600,7 @@ "type": "github" } }, - "systems_3": { + "systems_4": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -572,6 +619,24 @@ "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" + } + }, + "utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { "lastModified": 1726560853, "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", diff --git a/flake.nix b/flake.nix index cea4163..ec24761 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,8 @@ hyprland.url = "github:hyprwm/Hyprland"; hydractify-bot.url = "github:hydractify/hydractify-bot"; + + gakuen-cosplay.url = "git+file:///mnt/internal/shared/work/gakuen/projects/cosplayer_submission"; }; outputs = diff --git a/specific/desktop/home-manager.nix b/specific/desktop/home-manager.nix index d8ef6ab..a89a4f7 100644 --- a/specific/desktop/home-manager.nix +++ b/specific/desktop/home-manager.nix @@ -11,6 +11,7 @@ ./services/openttd.nix ./services/terraria.nix ./services/hydractify-bot.nix + ./services/gakuen-cosplay-api.nix ]; # Home Manager needs a bit of information about you and the paths it should diff --git a/specific/desktop/services/caddy.nix b/specific/desktop/services/caddy.nix index c421273..7fbce66 100644 --- a/specific/desktop/services/caddy.nix +++ b/specific/desktop/services/caddy.nix @@ -42,5 +42,16 @@ 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 + ''; }; } diff --git a/specific/desktop/services/gakuen-cosplay-api.nix b/specific/desktop/services/gakuen-cosplay-api.nix new file mode 100644 index 0000000..ede2c1d --- /dev/null +++ b/specific/desktop/services/gakuen-cosplay-api.nix @@ -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"; + }; + }; +}