]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - modules/private/websites/tools/games/terraforming-mars/default.nix
Add chatons infos
[perso/Immae/Config/Nix.git] / modules / private / websites / tools / games / terraforming-mars / default.nix
1 { config, lib, pkgs, ... }:
2 let
3 cfg = config.myServices.websites.games.terraforming-mars;
4 terraforming-mars = pkgs.callPackage ./terraforming-mars.nix {};
5 in
6 {
7 options.myServices.websites.games.terraforming-mars.enable = lib.mkEnableOption "Enable Terraforming mars game";
8 config = lib.mkIf cfg.enable {
9 myServices.chatonsProperties.services.terraforming-mars = {
10 file.datetime = "2022-08-27T14:20:00";
11 service = {
12 name = "Terraforming Mars";
13 description = "Terraforming Mars Boardgame";
14 website = "https://terraforming-mars.games.immae.eu/";
15 logo = "https://terraforming-mars.games.immae.eu/favicon.ico";
16 status.level = "OK";
17 status.description = "OK";
18 registration."" = ["NONE"];
19 registration.load = "OPEN";
20 install.type = "PACKAGE";
21 };
22 software = {
23 name = "Terraforming Mars";
24 website = "https://github.com/terraforming-mars/terraforming-mars";
25 license.url = "https://github.com/terraforming-mars/terraforming-mars/blob/main/LICENSE";
26 license.name = "GNU General Public License v3.0";
27 version = "unversionned";
28 source.url = "https://github.com/terraforming-mars/terraforming-mars";
29 };
30 };
31 systemd.services.terraforming-mars = {
32 path = [ pkgs.nodejs pkgs.bashInteractive ];
33 description = "Terraforming mars game";
34 wantedBy = [ "multi-user.target" ];
35 script = ''
36 export PORT=/run/terraforming-mars/socket.sock
37 export NODE_ENV=production
38 mkdir -p /var/lib/terraforming-mars/db
39 npm run start
40 '';
41 postStart = ''
42 sleep 5;
43 chown :wwwrun /run/terraforming-mars/socket.sock
44 chmod g+w /run/terraforming-mars/socket.sock
45 '';
46 serviceConfig = {
47 User = "terraformingmars";
48 DynamicUser = true;
49 SupplementaryGroups = [ "wwwrun" ];
50 Type = "simple";
51 WorkingDirectory = terraforming-mars;
52 RuntimeDirectory = "terraforming-mars";
53 StateDirectory = "terraforming-mars";
54 };
55 };
56
57 services.websites.env.tools.vhostConfs.games_terraforming-mars = {
58 certName = "games";
59 certMainHost = "games.immae.eu";
60 hosts = [ "terraforming-mars.games.immae.eu" ];
61 root = null;
62 extraConfig = [
63 ''
64 ProxyPass / unix:///run/terraforming-mars/socket.sock|http://terraforming-mars.games.immae.eu/
65 ProxyPassReverse / unix:///run/terraforming-mars/socket.sock|http://terraforming-mars.games.immae.eu/
66 ''
67 ];
68 };
69 };
70 }