]>
Commit | Line | Data |
---|---|---|
de6002a1 IB |
1 | { config, lib, pkgs, ... }: |
2 | let | |
3 | greenapid = pkgs.callPackage ./greenapid.nix {}; | |
4 | frontend = pkgs.callPackage ./frontend.nix { nodeEnv = pkgs.callPackage pkgs.mylibs.nodeEnv {}; }; | |
5 | wordlists = pkgs.runCommand "wordlists" {} '' | |
6 | mkdir -p $out | |
7 | cp -r ${./wordlists} $out/wordlists | |
8 | ''; | |
9 | cfg = config.myServices.websites.games.codenames; | |
10 | in | |
11 | { | |
12 | options.myServices.websites.games.codenames.enable = lib.mkEnableOption "Enable Codenames game"; | |
13 | config = lib.mkIf cfg.enable { | |
1a64deeb IB |
14 | myServices.dns.zones."immae.eu".subdomains.games.subdomains.codenames = with config.myServices.dns.helpers; |
15 | ips servers.eldiron.ips.main; | |
16 | ||
17 | myServices.chatonsProperties.services.codenames = { | |
18 | file.datetime = "2022-08-27T14:08:00"; | |
19 | service = { | |
20 | name = "Codenames Green"; | |
21 | description = "Co-op codenames app"; | |
22 | website = "https://codenames.games.immae.eu/"; | |
23 | logo = "https://codenames.games.immae.eu/images/apple-touch-icon.png"; | |
24 | status.level = "OK"; | |
25 | status.description = "OK"; | |
26 | registration."" = ["NONE"]; | |
27 | registration.load = "OPEN"; | |
28 | install.type = "PACKAGE"; | |
29 | }; | |
30 | software = { | |
31 | name = "Codenames Green"; | |
32 | website = "https://www.codenamesgreen.com/"; | |
33 | license.url = "https://github.com/jbowens/codenamesgreen/blob/master/package.json"; | |
34 | license.name = "MIT"; | |
35 | version = greenapid.version; | |
36 | source.url = "https://github.com/jbowens/codenamesgreen"; | |
37 | }; | |
38 | }; | |
de6002a1 IB |
39 | systemd.services.codenames_api = { |
40 | description = "Api for codenames game"; | |
41 | wantedBy = [ "multi-user.target" ]; | |
42 | script = "${greenapid}/bin/greenapid"; | |
43 | postStart = '' | |
44 | sleep 5; | |
45 | chown :wwwrun /run/codenamesgreen/socket.sock | |
46 | chmod g+w /run/codenamesgreen/socket.sock | |
47 | ''; | |
48 | serviceConfig = { | |
49 | User = "codenames"; | |
50 | DynamicUser = true; | |
51 | SupplementaryGroups = [ "wwwrun" ]; | |
52 | Type = "simple"; | |
53 | RuntimeDirectory = "codenamesgreen"; | |
54 | WorkingDirectory = builtins.toString wordlists; | |
55 | }; | |
56 | }; | |
57 | ||
1a64deeb IB |
58 | security.acme.certs.games.domain = "games.immae.eu"; |
59 | security.acme.certs.games.extraDomainNames = [ "codenames.games.immae.eu" ]; | |
de6002a1 IB |
60 | services.websites.env.tools.vhostConfs.games_codenames = { |
61 | certName = "games"; | |
de6002a1 IB |
62 | hosts = [ "codenames.games.immae.eu" ]; |
63 | root = frontend; | |
64 | extraConfig = [ | |
65 | '' | |
66 | ProxyPass /api/ unix:///run/codenamesgreen/socket.sock|http://codenames.games.immae.eu/ | |
67 | ProxyPassReverse /api/ unix:///run/codenamesgreen/socket.sock|http://codenames.games.immae.eu/ | |
68 | ||
69 | <Directory ${frontend}> | |
70 | FallbackResource index.html | |
71 | </Directory> | |
72 | '' | |
73 | ]; | |
74 | }; | |
75 | }; | |
76 | } |