mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-19 08:31:01 +03:00

After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev 0128fbb0a5
result/bin/apply-formatting $NIXPKGS_PATH
118 lines
2.6 KiB
Nix
118 lines
2.6 KiB
Nix
{
|
|
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.port;
|
|
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.str;
|
|
default = "0.0.0.0";
|
|
description = ''
|
|
By default, the Drone RPC server will listen on all interfaces and
|
|
local IPv4 addresses 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.str;
|
|
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}
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
}
|