]>
Commit | Line | Data |
---|---|---|
f036e975 IB |
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 { | |
1a64deeb IB |
9 | myServices.dns.zones."immae.eu".subdomains.games.subdomains.terraforming-mars = with config.myServices.dns.helpers; |
10 | ips servers.eldiron.ips.main; | |
11 | myServices.chatonsProperties.services.terraforming-mars = { | |
12 | file.datetime = "2022-08-27T14:20:00"; | |
13 | service = { | |
14 | name = "Terraforming Mars"; | |
15 | description = "Terraforming Mars Boardgame"; | |
16 | website = "https://terraforming-mars.games.immae.eu/"; | |
17 | logo = "https://terraforming-mars.games.immae.eu/favicon.ico"; | |
18 | status.level = "OK"; | |
19 | status.description = "OK"; | |
20 | registration."" = ["NONE"]; | |
21 | registration.load = "OPEN"; | |
22 | install.type = "PACKAGE"; | |
23 | }; | |
24 | software = { | |
25 | name = "Terraforming Mars"; | |
26 | website = "https://github.com/terraforming-mars/terraforming-mars"; | |
27 | license.url = "https://github.com/terraforming-mars/terraforming-mars/blob/main/LICENSE"; | |
28 | license.name = "GNU General Public License v3.0"; | |
29 | version = "unversionned"; | |
30 | source.url = "https://github.com/terraforming-mars/terraforming-mars"; | |
31 | }; | |
32 | }; | |
f036e975 | 33 | systemd.services.terraforming-mars = { |
1a64deeb | 34 | path = [ pkgs.nodejs_16 pkgs.bashInteractive ]; |
f036e975 IB |
35 | description = "Terraforming mars game"; |
36 | wantedBy = [ "multi-user.target" ]; | |
37 | script = '' | |
38 | export PORT=/run/terraforming-mars/socket.sock | |
39 | export NODE_ENV=production | |
40 | mkdir -p /var/lib/terraforming-mars/db | |
41 | npm run start | |
42 | ''; | |
43 | postStart = '' | |
44 | sleep 5; | |
45 | chown :wwwrun /run/terraforming-mars/socket.sock | |
46 | chmod g+w /run/terraforming-mars/socket.sock | |
47 | ''; | |
1a64deeb IB |
48 | environment.NPM_CONFIG_LOGS_DIR = "%S/terraforming-mars/npm_logs"; |
49 | environment.NPM_CONFIG_CACHE = "%S/terraforming-mars/npm_cache"; | |
f036e975 IB |
50 | serviceConfig = { |
51 | User = "terraformingmars"; | |
52 | DynamicUser = true; | |
53 | SupplementaryGroups = [ "wwwrun" ]; | |
54 | Type = "simple"; | |
55 | WorkingDirectory = terraforming-mars; | |
56 | RuntimeDirectory = "terraforming-mars"; | |
57 | StateDirectory = "terraforming-mars"; | |
58 | }; | |
59 | }; | |
60 | ||
1a64deeb IB |
61 | security.acme.certs.games.extraDomainNames = [ "terraforming-mars.games.immae.eu" ]; |
62 | security.acme.certs.games.domain = "games.immae.eu"; | |
f036e975 IB |
63 | services.websites.env.tools.vhostConfs.games_terraforming-mars = { |
64 | certName = "games"; | |
f036e975 IB |
65 | hosts = [ "terraforming-mars.games.immae.eu" ]; |
66 | root = null; | |
67 | extraConfig = [ | |
68 | '' | |
69 | ProxyPass / unix:///run/terraforming-mars/socket.sock|http://terraforming-mars.games.immae.eu/ | |
70 | ProxyPassReverse / unix:///run/terraforming-mars/socket.sock|http://terraforming-mars.games.immae.eu/ | |
71 | '' | |
72 | ]; | |
73 | }; | |
74 | }; | |
75 | } |