mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-30 19:02:57 +00:00
6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
89 lines
2.4 KiB
Nix
89 lines
2.4 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
inherit (lib) mkEnableOption mkPackageOption mkIf mkOption types literalExpression;
|
|
|
|
cfg = config.services.meme-bingo-web;
|
|
in {
|
|
options = {
|
|
services.meme-bingo-web = {
|
|
enable = mkEnableOption ''
|
|
a web app for the meme bingo, rendered entirely on the web server and made interactive with forms.
|
|
|
|
Note: The application's author suppose to run meme-bingo-web behind a reverse proxy for SSL and HTTP/3
|
|
'';
|
|
|
|
package = mkPackageOption pkgs "meme-bingo-web" { };
|
|
|
|
baseUrl = mkOption {
|
|
description = ''
|
|
URL to be used for the HTML <base> element on all HTML routes.
|
|
'';
|
|
type = types.str;
|
|
default = "http://localhost:41678/";
|
|
example = "https://bingo.example.com/";
|
|
};
|
|
port = mkOption {
|
|
description = ''
|
|
Port to be used for the web server.
|
|
'';
|
|
type = types.port;
|
|
default = 41678;
|
|
example = 21035;
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
systemd.services.meme-bingo-web = {
|
|
description = "A web app for playing meme bingos.";
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
environment = {
|
|
MEME_BINGO_BASE = cfg.baseUrl;
|
|
MEME_BINGO_PORT = toString cfg.port;
|
|
};
|
|
path = [ cfg.package ];
|
|
|
|
serviceConfig = {
|
|
User = "meme-bingo-web";
|
|
Group = "meme-bingo-web";
|
|
|
|
DynamicUser = true;
|
|
|
|
ExecStart = "${cfg.package}/bin/meme-bingo-web";
|
|
|
|
Restart = "always";
|
|
RestartSec = 1;
|
|
|
|
# Hardening
|
|
CapabilityBoundingSet = [ "" ];
|
|
DeviceAllow = [ "/dev/random" ];
|
|
LockPersonality = true;
|
|
PrivateDevices = true;
|
|
PrivateUsers = true;
|
|
ProcSubset = "pid";
|
|
ProtectSystem = "strict";
|
|
ProtectClock = true;
|
|
ProtectControlGroups = true;
|
|
ProtectHome = true;
|
|
ProtectHostname = true;
|
|
ProtectKernelLogs = true;
|
|
ProtectKernelModules = true;
|
|
ProtectKernelTunables = true;
|
|
ProtectProc = "invisible";
|
|
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
|
|
RestrictNamespaces = true;
|
|
RestrictRealtime = true;
|
|
SystemCallArchitectures = "native";
|
|
SystemCallFilter = [ "@system-service" "~@privileged" "~@resources" ];
|
|
UMask = "0077";
|
|
RestrictSUIDSGID = true;
|
|
RemoveIPC = true;
|
|
NoNewPrivileges = true;
|
|
MemoryDenyWriteExecute = true;
|
|
};
|
|
};
|
|
};
|
|
}
|