Allows tuning fragmentation parameters for performance. Defaults match CLI defaults (min 3, max 8, delay 500us).
27 lines
941 B
Nix
27 lines
941 B
Nix
self:
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
cfg = config.services.ihtc;
|
|
system = pkgs.stdenv.hostPlatform.system;
|
|
regex = builtins.concatStringsSep "|" cfg.patterns;
|
|
in
|
|
{
|
|
imports = [ ./options.nix ];
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
launchd.user.agents.ihtc = {
|
|
command = "${self.packages.${system}.ihtc}/bin/ihtc --listen 127.0.0.1:${toString cfg.port} --min-chunk ${toString cfg.minChunk} --max-chunk ${toString cfg.maxChunk} --delay-us ${toString cfg.delayUs} --refrag ${toString cfg.refrag} --auto-proxy"
|
|
+ lib.optionalString cfg.verbose " --verbose"
|
|
+ lib.optionalString (cfg.patterns != [ ]) " --regex '${regex}'"
|
|
+ lib.optionalString (cfg.extraArgs != [ ]) " ${builtins.concatStringsSep " " cfg.extraArgs}";
|
|
serviceConfig = {
|
|
RunAtLoad = true;
|
|
KeepAlive = true;
|
|
StandardOutPath = "/tmp/ihtc.log";
|
|
StandardErrorPath = "/tmp/ihtc.log";
|
|
};
|
|
};
|
|
};
|
|
}
|