nixos/modules/snapclient.nix

30 lines
795 B
Nix

{
pkgs,
lib,
config,
...
}:
let cfg = config.services.snapclient; in
{
options.services.snapclient.enable = lib.mkEnableOption "a local snapclient service";
options.services.snapclient.latency = lib.mkOption {
type = lib.types.number;
description = "latency of the PCM device";
default = 0;
};
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"
"default.target"
];
after = [
"pipewire.service"
];
serviceConfig = {
ExecStart = "${pkgs.snapcast}/bin/snapclient --host snapserver --player pulse --latency ${builtins.toString cfg.latency}";
Slice="session.slice";
};
};
}