Add webone, misc changes.

This commit is contained in:
Fern Garden 2025-07-09 12:02:55 +08:00
parent f1216bc9ad
commit 997b93d6ca
5 changed files with 102 additions and 22 deletions

65
modules/webone.nix Normal file
View file

@ -0,0 +1,65 @@
{
config,
lib,
userPackages,
...
}:
with lib;
let
cfg = config.services.webone;
in
{
options.services.webone.enable = mkEnableOption "Enable WebOne HTTP proxy.";
config = mkIf cfg.enable {
users.groups.webone = { };
users.users.webone = {
createHome = true;
isSystemUser = true;
home = "/var/lib/webone";
group = "webone";
};
systemd.tmpfiles.settings = {
"10-webone" = {
"/var/log/webone.log" = {
f = {
group = "webone";
mode = "0664";
user = "webone";
};
};
"/etc/webone.conf.d" = {
d = {
group = "webone";
mode = "0755";
user = "webone";
};
};
};
};
systemd.services.webone = {
description = "WebOne HTTP Proxy Server";
documentation = [ "https://github.com/atauenis/webone/wiki/" ];
requires = [ "network-online.target" ];
after = [ "network-online.target" ];
wantedBy = [ "default.target" ];
startLimitIntervalSec = 5;
startLimitBurst = 3;
environment = {
OPENSSL_CONF = "${userPackages.webone}/lib/webone/openssl_webone.cnf";
};
serviceConfig = {
Type = "simple";
User = "webone";
Group = "webone";
ExecStart = "${userPackages.webone}/bin/webone";
TimeoutStopSec = "10";
Restart = "on-failure";
RestartSec = "5";
};
};
};
}