1 { config, pkgs, lib, ... }:
7 cfg = config.services.sniproxy;
9 configFile = pkgs.writeText "sniproxy.conf" ''
11 pidfile /run/sniproxy.pid
17 imports = [ (mkRemovedOptionModule [ "services" "sniproxy" "logDir" ] "Now done by LogsDirectory=. Set to a custom path if you log to a different folder in your config.") ];
21 enable = mkEnableOption "sniproxy server";
26 description = "User account under which sniproxy runs.";
32 description = "Group under which sniproxy runs.";
38 description = "sniproxy.conf configuration excluding the daemon username and pid file.";
41 filename /var/log/sniproxy/error.log
44 filename /var/log/sniproxy/access.log
50 example.com 192.0.2.10
51 example.net 192.0.2.20
59 config = mkIf cfg.enable {
60 systemd.services.sniproxy = {
61 description = "sniproxy server";
62 after = [ "network.target" ];
63 wantedBy = [ "multi-user.target" ];
67 ExecStart = "${pkgs.sniproxy}/bin/sniproxy -c ${configFile}";
68 LogsDirectory = "sniproxy";
69 LogsDirectoryMode = "0640";
74 users.users = mkIf (cfg.user == "sniproxy") {
77 uid = config.ids.uids.sniproxy;
81 users.groups = mkIf (cfg.group == "sniproxy") {
83 gid = config.ids.gids.sniproxy;