1 { config, lib, pkgs, ... }:
4 inherit (lib) mkEnableOption mkPackageOption mkIf mkOption types literalExpression;
6 cfg = config.services.meme-bingo-web;
9 services.meme-bingo-web = {
10 enable = mkEnableOption ''
11 a web app for the meme bingo, rendered entirely on the web server and made interactive with forms.
13 Note: The application's author suppose to run meme-bingo-web behind a reverse proxy for SSL and HTTP/3
16 package = mkPackageOption pkgs "meme-bingo-web" { };
20 URL to be used for the HTML \<base\> element on all HTML routes.
23 default = "http://localhost:41678/";
24 example = "https://bingo.example.com/";
28 Port to be used for the web server.
37 config = mkIf cfg.enable {
38 systemd.services.meme-bingo-web = {
39 description = "A web app for playing meme bingos";
40 wantedBy = [ "multi-user.target" ];
43 MEME_BINGO_BASE = cfg.baseUrl;
44 MEME_BINGO_PORT = toString cfg.port;
46 path = [ cfg.package ];
49 User = "meme-bingo-web";
50 Group = "meme-bingo-web";
54 ExecStart = "${cfg.package}/bin/meme-bingo-web";
60 CapabilityBoundingSet = [ "" ];
61 DeviceAllow = [ "/dev/random" ];
62 InaccessiblePaths = [ "/dev/shm" "/sys" ];
63 LockPersonality = true;
64 PrivateDevices = true;
67 ProtectSystem = "strict";
69 ProtectControlGroups = true;
71 ProtectHostname = true;
72 ProtectKernelLogs = true;
73 ProtectKernelModules = true;
74 ProtectKernelTunables = true;
75 ProtectProc = "invisible";
76 RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
77 RestrictFilesystems = [ "@basic-api" "~sysfs" ];
78 RestrictNamespaces = true;
79 RestrictRealtime = true;
80 SystemCallArchitectures = "native";
81 SystemCallFilter = [ "@system-service" "~@privileged" "~@resources" ];
83 RestrictSUIDSGID = true;
85 NoNewPrivileges = true;
86 MemoryDenyWriteExecute = true;