diff options
author | goibhniu <cillian.deroiste@gmail.com> | 2016-01-11 00:09:32 +0100 |
---|---|---|
committer | goibhniu <cillian.deroiste@gmail.com> | 2016-01-11 00:09:32 +0100 |
commit | 8b8f864e487f8605717c31bea0b8fb6e5feb5769 (patch) | |
tree | 56a07d05222a49c8ff6ccae53969e8fe4fdbcb05 /nixos/modules/services/networking | |
parent | 3136bd49d834f5db9bac0d13d4919db1b384e983 (diff) | |
parent | e3c061e6ef989fa00d6289f4f9a6abed585ff482 (diff) | |
download | nixlib-8b8f864e487f8605717c31bea0b8fb6e5feb5769.tar nixlib-8b8f864e487f8605717c31bea0b8fb6e5feb5769.tar.gz nixlib-8b8f864e487f8605717c31bea0b8fb6e5feb5769.tar.bz2 nixlib-8b8f864e487f8605717c31bea0b8fb6e5feb5769.tar.lz nixlib-8b8f864e487f8605717c31bea0b8fb6e5feb5769.tar.xz nixlib-8b8f864e487f8605717c31bea0b8fb6e5feb5769.tar.zst nixlib-8b8f864e487f8605717c31bea0b8fb6e5feb5769.zip |
Merge pull request #12103 from rick68/ostinato
Ostinato
Diffstat (limited to 'nixos/modules/services/networking')
-rw-r--r-- | nixos/modules/services/networking/ostinato.nix | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/nixos/modules/services/networking/ostinato.nix b/nixos/modules/services/networking/ostinato.nix new file mode 100644 index 000000000000..13f784dc53c1 --- /dev/null +++ b/nixos/modules/services/networking/ostinato.nix @@ -0,0 +1,104 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + pkg = pkgs.ostinato; + cfg = config.services.ostinato; + configFile = pkgs.writeText "drone.ini" '' + [General] + RateAccuracy=${cfg.rateAccuracy} + + [RpcServer] + Address=${cfg.rpcServer.address} + + [PortList] + Include=${concatStringsSep "," cfg.portList.include} + Exclude=${concatStringsSep "," cfg.portList.exclude} + ''; + +in +{ + + ###### interface + + options = { + + services.ostinato = { + + enable = mkEnableOption "Ostinato agent-controller (Drone)"; + + port = mkOption { + type = types.int; + default = 7878; + description = '' + Port to listen on. + ''; + }; + + rateAccuracy = mkOption { + type = types.enum [ "High" "Low" ]; + default = "High"; + description = '' + To ensure that the actual transmit rate is as close as possible to + the configured transmit rate, Drone runs a busy-wait loop. + While this provides the maximum accuracy possible, the CPU + utilization is 100% while the transmit is on. You can however, + sacrifice the accuracy to reduce the CPU load. + ''; + }; + + rpcServer = { + address = mkOption { + type = types.string; + default = "0.0.0.0"; + description = '' + By default, the Drone RPC server will listen on all interfaces and + local IPv4 adresses for incoming connections from clients. Specify + a single IPv4 or IPv6 address if you want to restrict that. + To listen on any IPv6 address, use :: + ''; + }; + }; + + portList = { + include = mkOption { + type = types.listOf types.string; + default = []; + example = ''[ "eth*" "lo*" ]''; + description = '' + For a port to pass the filter and appear on the port list managed + by drone, it be allowed by this include list. + ''; + }; + exclude = mkOption { + type = types.listOf types.str; + default = []; + example = ''[ "usbmon*" "eth0" ]''; + description = '' + A list of ports does not appear on the port list managed by drone. + ''; + }; + }; + + }; + + }; + + ###### implementation + + config = mkIf cfg.enable { + + environment.systemPackages = [ pkg ]; + + systemd.services.drone = { + description = "Ostinato agent-controller"; + wantedBy = [ "multi-user.target" ]; + script = '' + ${pkg}/bin/drone ${toString cfg.port} ${configFile} + ''; + }; + + }; + +} |