2021-08-10 14:31:46 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
2021-10-06 13:57:05 +00:00
|
|
|
inherit (lib) mkEnableOption mkIf mkOption types literalExpression;
|
2021-08-10 14:31:46 +00:00
|
|
|
|
|
|
|
cfg = config.services.isso;
|
|
|
|
|
|
|
|
settingsFormat = pkgs.formats.ini { };
|
|
|
|
configFile = settingsFormat.generate "isso.conf" cfg.settings;
|
|
|
|
in {
|
|
|
|
|
|
|
|
options = {
|
|
|
|
services.isso = {
|
2022-09-09 14:08:57 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc ''
|
2021-08-10 14:31:46 +00:00
|
|
|
A commenting server similar to Disqus.
|
|
|
|
|
|
|
|
Note: The application's author suppose to run isso behind a reverse proxy.
|
|
|
|
The embedded solution offered by NixOS is also only suitable for small installations
|
|
|
|
below 20 requests per second.
|
2022-09-09 14:08:57 +00:00
|
|
|
'');
|
2021-08-10 14:31:46 +00:00
|
|
|
|
|
|
|
settings = mkOption {
|
2022-08-21 13:32:41 +00:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
Configuration for `isso`.
|
2021-08-10 14:31:46 +00:00
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
See [Isso Server Configuration](https://posativ.org/isso/docs/configuration/server/)
|
2021-08-10 14:31:46 +00:00
|
|
|
for supported values.
|
|
|
|
'';
|
|
|
|
|
|
|
|
type = types.submodule {
|
|
|
|
freeformType = settingsFormat.type;
|
|
|
|
};
|
|
|
|
|
2021-10-06 13:57:05 +00:00
|
|
|
example = literalExpression ''
|
2021-08-10 14:31:46 +00:00
|
|
|
{
|
|
|
|
general = {
|
|
|
|
host = "http://localhost";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
services.isso.settings.general.dbpath = lib.mkDefault "/var/lib/isso/comments.db";
|
|
|
|
|
|
|
|
systemd.services.isso = {
|
|
|
|
description = "isso, a commenting server similar to Disqus";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
|
|
|
|
serviceConfig = {
|
|
|
|
User = "isso";
|
|
|
|
Group = "isso";
|
|
|
|
|
|
|
|
DynamicUser = true;
|
|
|
|
|
|
|
|
StateDirectory = "isso";
|
|
|
|
|
|
|
|
ExecStart = ''
|
|
|
|
${pkgs.isso}/bin/isso -c ${configFile}
|
|
|
|
'';
|
|
|
|
|
|
|
|
Restart = "on-failure";
|
|
|
|
RestartSec = 1;
|
2022-12-02 08:20:57 +00:00
|
|
|
|
|
|
|
# Hardening
|
|
|
|
CapabilityBoundingSet = [ "" ];
|
|
|
|
DeviceAllow = [ "" ];
|
|
|
|
LockPersonality = true;
|
|
|
|
PrivateDevices = true;
|
|
|
|
PrivateUsers = true;
|
|
|
|
ProcSubset = "pid";
|
|
|
|
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";
|
2021-08-10 14:31:46 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|