mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
feat(mediabox): wyoming
This commit is contained in:
parent
a5966c0724
commit
a202d0703f
9 changed files with 283 additions and 2 deletions
60
modules/system/exports/wyoming.nix
Normal file
60
modules/system/exports/wyoming.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
lib,
|
||||
gensokyo-zone,
|
||||
...
|
||||
}: let
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault;
|
||||
inherit (lib.modules) mkIf;
|
||||
wyomingService = {config, ...}: {
|
||||
nixos = {
|
||||
serviceAttrPath = ["services" "wyoming" config.name];
|
||||
assertions = [
|
||||
(nixosConfig: let
|
||||
service = nixosConfig.services.wyoming.${config.name};
|
||||
cfg = service.servers.${config.id} or service;
|
||||
in {
|
||||
assertion = (! cfg ? enable) || (config.enable == cfg.enable);
|
||||
message = "enable mismatch";
|
||||
})
|
||||
(mkIf config.enable (nixosConfig: let
|
||||
service = nixosConfig.services.wyoming.${config.name};
|
||||
cfg = service.servers.${config.id} or service;
|
||||
in {
|
||||
assertion = ! cfg.enable or false || config.ports.default.port == cfg.port or null;
|
||||
message = "port mismatch";
|
||||
}))
|
||||
];
|
||||
};
|
||||
defaults.port.listen = mkAlmostOptionDefault "lan";
|
||||
ports = {
|
||||
default = {
|
||||
transport = "tcp";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
config.exports.services = {
|
||||
faster-whisper = {config, ...}: {
|
||||
imports = [wyomingService];
|
||||
displayName = mkAlmostOptionDefault "Wyoming Whisper";
|
||||
id = mkAlmostOptionDefault "whisper";
|
||||
ports.default.port = mkAlmostOptionDefault 10300;
|
||||
};
|
||||
piper = {config, ...}: {
|
||||
imports = [wyomingService];
|
||||
displayName = mkAlmostOptionDefault "Wyoming Piper";
|
||||
id = mkAlmostOptionDefault "piper";
|
||||
ports.default.port = mkAlmostOptionDefault 10200;
|
||||
};
|
||||
openwakeword = {config, ...}: {
|
||||
imports = [wyomingService];
|
||||
displayName = mkAlmostOptionDefault "Wyoming openWakeWord";
|
||||
ports.default.port = mkAlmostOptionDefault 10400;
|
||||
};
|
||||
satellite = {config, ...}: {
|
||||
imports = [wyomingService];
|
||||
displayName = mkAlmostOptionDefault "Wyoming Satellite";
|
||||
ports.default.port = mkAlmostOptionDefault 10700;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue