summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorPiotr Limanowski <plimanowski@codearsonist.com>2017-03-17 21:34:10 +0100
committerPiotr Limanowski <plimanowski@codearsonist.com>2017-03-19 23:33:26 +0100
commitb16b84abbf1a43af7b19501a16fa92ff78c4a50f (patch)
treefa1fcd594b80757090f136869d200f043ef7a012 /modules
parentb95323278fa090de3ea9c1d50763be0acc36ea3d (diff)
Adds mopidy service with media keys support
Diffstat (limited to 'modules')
-rw-r--r--modules/services/mopidy.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/modules/services/mopidy.nix b/modules/services/mopidy.nix
new file mode 100644
index 0000000..c22f1d1
--- /dev/null
+++ b/modules/services/mopidy.nix
@@ -0,0 +1,61 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.services.mopidy;
+
+in
+
+{
+ options = {
+ services.mopidy = {
+
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the Mopidy Daemon.";
+ };
+
+ package = mkOption {
+ type = types.path;
+ default = pkgs.mopidy;
+ description = "This option specifies the mopidy package to use.";
+ };
+
+ mediakeys = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = "Whether to enable the Mopidy OSX Media Keys support daemon.";
+ };
+ package = mkOption {
+ type = types.path;
+ default = pkgs.pythonPackages.osxmpdkeys;
+ description = "This option specifies the mediakeys package to use.";
+ };
+ };
+
+ };
+ };
+
+ config = mkMerge [
+ (mkIf cfg.enable {
+ launchd.user.agents.mopidy = {
+ serviceConfig.Program = "${cfg.package}/bin/mopidy";
+ serviceConfig.RunAtLoad = true;
+ serviceConfig.KeepAlive = true;
+ serviceConfig.ProcessType = "Adaptive";
+ };
+ })
+ (mkIf cfg.mediakeys.enable {
+ launchd.user.agents.mopidymediakeys = {
+ serviceConfig.Program = "${cfg.package}/bin/mpdkeys";
+ serviceConfig.RunAtLoad = true;
+ serviceConfig.KeepAlive = true;
+ serviceConfig.ProcessType = "Interactive";
+ };
+ })
+ ];
+}