2024-10-30 17:39:29 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let cfg = config.services.snapclient; in
|
|
|
|
{
|
|
|
|
options.services.snapclient.enable = lib.mkEnableOption "a local snapclient service";
|
2024-11-01 19:52:41 +01:00
|
|
|
options.services.snapclient.latency = lib.mkOption {
|
|
|
|
type = lib.types.number;
|
|
|
|
description = "latency of the PCM device";
|
|
|
|
default = 0;
|
|
|
|
};
|
2024-10-30 17:39:29 +01:00
|
|
|
|
|
|
|
config.systemd.user.services.snapclient = lib.mkIf cfg.enable {
|
|
|
|
wantedBy = lib.warnIfNot config.services.pipewire.enable "Pipewire is not running, snapclient won't work" [
|
|
|
|
"pipewire.service"
|
2024-11-01 14:28:53 +01:00
|
|
|
"default.target"
|
2024-10-30 17:39:29 +01:00
|
|
|
];
|
|
|
|
after = [
|
|
|
|
"pipewire.service"
|
|
|
|
];
|
|
|
|
serviceConfig = {
|
2024-11-01 19:52:41 +01:00
|
|
|
ExecStart = "${pkgs.snapcast}/bin/snapclient --host snapserver --player pulse --latency ${builtins.toString cfg.latency}";
|
2024-10-30 17:39:29 +01:00
|
|
|
Slice="session.slice";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|