nixos/modules/snapclient.nix

35 lines
914 B
Nix
Raw Permalink Normal View History

{
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.lan --player pulse --latency ${builtins.toString cfg.latency}";
Slice = "session.slice";
Restart = "on-failure";
RestartSec = 60;
};
unitConfig = {
StartLimitIntervalSec = 0;
};
};
}