2017-03-17 21:34:10 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.mopidy;
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
options = {
|
2017-10-19 22:16:09 +02:00
|
|
|
services.mopidy.enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2024-04-14 23:02:32 +02:00
|
|
|
description = "Whether to enable the Mopidy Daemon.";
|
2017-10-19 22:16:09 +02:00
|
|
|
};
|
2017-03-17 21:34:10 +01:00
|
|
|
|
2017-10-19 22:16:09 +02:00
|
|
|
services.mopidy.package = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
default = pkgs.mopidy;
|
|
|
|
defaultText = "pkgs.mopidy";
|
2024-04-14 23:02:32 +02:00
|
|
|
description = "This option specifies the mopidy package to use.";
|
2017-10-19 22:16:09 +02:00
|
|
|
};
|
2017-03-17 21:34:10 +01:00
|
|
|
|
2017-10-19 22:16:09 +02:00
|
|
|
services.mopidy.mediakeys.enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2024-04-14 23:02:32 +02:00
|
|
|
description = "Whether to enable the Mopidy OSX Media Keys support daemon.";
|
2017-10-19 22:16:09 +02:00
|
|
|
};
|
2017-03-17 21:34:10 +01:00
|
|
|
|
2017-10-19 22:16:09 +02:00
|
|
|
services.mopidy.mediakeys.package = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
default = pkgs.pythonPackages.osxmpdkeys;
|
|
|
|
defaultText = "pkgs.pythonPackages.osxmpdkeys";
|
2024-04-14 23:02:32 +02:00
|
|
|
description = "This option specifies the mediakeys package to use.";
|
2017-03-17 21:34:10 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkMerge [
|
|
|
|
(mkIf cfg.enable {
|
|
|
|
launchd.user.agents.mopidy = {
|
|
|
|
serviceConfig.Program = "${cfg.package}/bin/mopidy";
|
|
|
|
serviceConfig.RunAtLoad = true;
|
|
|
|
serviceConfig.KeepAlive = true;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
(mkIf cfg.mediakeys.enable {
|
|
|
|
launchd.user.agents.mopidymediakeys = {
|
|
|
|
serviceConfig.Program = "${cfg.package}/bin/mpdkeys";
|
|
|
|
serviceConfig.RunAtLoad = true;
|
|
|
|
serviceConfig.KeepAlive = true;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|