blob: e90e72fb82bf3c84c830ab2d60958f99182e4da7 (
plain) (
blame)
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
71
72
73
74
75
|
{ config, lib, pkgs, ... }:
let
cfg = config.myServices.websites.games.terraforming-mars;
terraforming-mars = pkgs.callPackage ./terraforming-mars.nix {};
in
{
options.myServices.websites.games.terraforming-mars.enable = lib.mkEnableOption "Enable Terraforming mars game";
config = lib.mkIf cfg.enable {
myServices.dns.zones."immae.eu".subdomains.games.subdomains.terraforming-mars = with config.myServices.dns.helpers;
ips servers.eldiron.ips.main;
myServices.chatonsProperties.services.terraforming-mars = {
file.datetime = "2022-08-27T14:20:00";
service = {
name = "Terraforming Mars";
description = "Terraforming Mars Boardgame";
website = "https://terraforming-mars.games.immae.eu/";
logo = "https://terraforming-mars.games.immae.eu/favicon.ico";
status.level = "OK";
status.description = "OK";
registration."" = ["NONE"];
registration.load = "OPEN";
install.type = "PACKAGE";
};
software = {
name = "Terraforming Mars";
website = "https://github.com/terraforming-mars/terraforming-mars";
license.url = "https://github.com/terraforming-mars/terraforming-mars/blob/main/LICENSE";
license.name = "GNU General Public License v3.0";
version = "unversionned";
source.url = "https://github.com/terraforming-mars/terraforming-mars";
};
};
systemd.services.terraforming-mars = {
path = [ pkgs.nodejs_16 pkgs.bashInteractive ];
description = "Terraforming mars game";
wantedBy = [ "multi-user.target" ];
script = ''
export PORT=/run/terraforming-mars/socket.sock
export NODE_ENV=production
mkdir -p /var/lib/terraforming-mars/db
npm run start
'';
postStart = ''
sleep 5;
chown :wwwrun /run/terraforming-mars/socket.sock
chmod g+w /run/terraforming-mars/socket.sock
'';
environment.NPM_CONFIG_LOGS_DIR = "%S/terraforming-mars/npm_logs";
environment.NPM_CONFIG_CACHE = "%S/terraforming-mars/npm_cache";
serviceConfig = {
User = "terraformingmars";
DynamicUser = true;
SupplementaryGroups = [ "wwwrun" ];
Type = "simple";
WorkingDirectory = terraforming-mars;
RuntimeDirectory = "terraforming-mars";
StateDirectory = "terraforming-mars";
};
};
security.acme.certs.games.extraDomainNames = [ "terraforming-mars.games.immae.eu" ];
security.acme.certs.games.domain = "games.immae.eu";
services.websites.env.tools.vhostConfs.games_terraforming-mars = {
certName = "games";
hosts = [ "terraforming-mars.games.immae.eu" ];
root = null;
extraConfig = [
''
ProxyPass / unix:///run/terraforming-mars/socket.sock|http://terraforming-mars.games.immae.eu/
ProxyPassReverse / unix:///run/terraforming-mars/socket.sock|http://terraforming-mars.games.immae.eu/
''
];
};
};
}
|