mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-05 08:17:01 +00:00
Adds mopidy service with media keys support
This commit is contained in:
parent
b95323278f
commit
b16b84abbf
2 changed files with 62 additions and 0 deletions
|
@ -39,6 +39,7 @@ let
|
|||
./modules/services/khd.nix
|
||||
./modules/services/kwm.nix
|
||||
./modules/services/emacs.nix
|
||||
./modules/services/mopidy.nix
|
||||
./modules/services/nix-daemon.nix
|
||||
./modules/services/nix-gc.nix
|
||||
./modules/programs/bash.nix
|
||||
|
|
61
modules/services/mopidy.nix
Normal file
61
modules/services/mopidy.nix
Normal file
|
@ -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";
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Add table
Reference in a new issue