8 cfg = config.services.wyoming.piper;
25 meta.buildDocsInSandbox = false;
27 options.services.wyoming.piper = with types; {
28 package = mkPackageOption pkgs "wyoming-piper" { };
33 Attribute set of piper instances to spawn.
35 type = types.attrsOf (types.submodule (
38 enable = mkEnableOption "Wyoming Piper server";
40 piper = mkPackageOption pkgs "piper-tts" { };
44 example = "en-us-ryan-medium";
46 Name of the voice model to use. See the following website for samples:
47 https://rhasspy.github.io/piper-samples/
52 type = strMatching "^(tcp|unix)://.*$";
53 example = "tcp://0.0.0.0:10200";
55 URI to bind the wyoming server to.
63 ID of a specific speaker in a multi-speaker model.
68 noiseScale = mkOption {
72 Generator noise value.
77 noiseWidth = mkOption {
81 Phoneme width noise value.
86 lengthScale = mkOption {
95 extraArgs = mkOption {
99 Extra arguments to pass to the server commandline.
101 apply = escapeShellArgs;
115 in mkIf (cfg.servers != {}) {
116 systemd.services = mapAttrs' (server: options:
117 nameValuePair "wyoming-piper-${server}" {
118 inherit (options) enable;
119 description = "Wyoming Piper server instance ${server}";
121 "network-online.target"
124 "network-online.target"
131 User = "wyoming-piper";
132 StateDirectory = "wyoming/piper";
133 # https://github.com/home-assistant/addons/blob/master/piper/rootfs/etc/s6-overlay/s6-rc.d/piper/run
135 ${cfg.package}/bin/wyoming-piper \
136 --data-dir $STATE_DIRECTORY \
137 --download-dir $STATE_DIRECTORY \
138 --uri ${options.uri} \
139 --piper ${options.piper}/bin/piper \
140 --voice ${options.voice} \
141 --speaker ${options.speaker} \
142 --length-scale ${options.lengthScale} \
143 --noise-scale ${options.noiseScale} \
144 --noise-w ${options.noiseWidth} ${options.extraArgs}
146 CapabilityBoundingSet = "";
148 DevicePolicy = "closed";
149 LockPersonality = true;
150 MemoryDenyWriteExecute = true;
151 PrivateDevices = true;
154 ProtectHostname = true;
155 ProtectKernelLogs = true;
156 ProtectKernelModules = true;
157 ProtectKernelTunables = true;
158 ProtectControlGroups = true;
159 ProtectProc = "invisible";
161 RestrictAddressFamilies = [
166 RestrictNamespaces = true;
167 RestrictRealtime = true;
168 SystemCallArchitectures = "native";