1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6 cfg = config.services.owamp;
7in
8{
9
10 ###### interface
11
12 options = {
13 services.owamp.enable = mkEnableOption (lib.mdDoc "OWAMP server");
14 };
15
16
17 ###### implementation
18
19 config = mkIf cfg.enable {
20 users.users.owamp = {
21 group = "owamp";
22 description = "Owamp daemon";
23 isSystemUser = true;
24 };
25
26 users.groups.owamp = { };
27
28 systemd.services.owamp = {
29 description = "Owamp server";
30 wantedBy = [ "multi-user.target" ];
31
32 serviceConfig = {
33 ExecStart="${pkgs.owamp}/bin/owampd -R /run/owamp -d /run/owamp -v -Z ";
34 PrivateTmp = true;
35 Restart = "always";
36 Type="simple";
37 User = "owamp";
38 Group = "owamp";
39 RuntimeDirectory = "owamp";
40 StateDirectory = "owamp";
41 AmbientCapabilities = "cap_net_bind_service";
42 };
43 };
44 };
45}