at 18.09-beta 913 B view raw
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 ''Enable OWAMP server''; 14 }; 15 16 17 ###### implementation 18 19 config = mkIf cfg.enable { 20 users.users = singleton { 21 name = "owamp"; 22 group = "owamp"; 23 description = "Owamp daemon"; 24 }; 25 26 users.groups = singleton { 27 name = "owamp"; 28 }; 29 30 systemd.services.owamp = { 31 description = "Owamp server"; 32 wantedBy = [ "multi-user.target" ]; 33 34 serviceConfig = { 35 ExecStart="${pkgs.owamp}/bin/owampd -R /run/owamp -d /run/owamp -v -Z "; 36 PrivateTmp = true; 37 Restart = "always"; 38 Type="simple"; 39 User = "owamp"; 40 Group = "owamp"; 41 RuntimeDirectory = "owamp"; 42 StateDirectory = "owamp"; 43 AmbientCapabilities = "cap_net_bind_service"; 44 }; 45 }; 46 }; 47}