From 16b6599c4d26b4562cd396a30d3a7357128c1418 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sun, 14 Apr 2024 14:06:38 -0400 Subject: [PATCH] home: added mpd service --- homeManagerModules/userServices/default.nix | 2 +- .../userServices/mpd/default.nix | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 homeManagerModules/userServices/mpd/default.nix diff --git a/homeManagerModules/userServices/default.nix b/homeManagerModules/userServices/default.nix index 157aeb20..628a77b5 100644 --- a/homeManagerModules/userServices/default.nix +++ b/homeManagerModules/userServices/default.nix @@ -4,7 +4,7 @@ pkgs, ... }: { - imports = [./syncthing ./easyeffects]; + imports = [./syncthing ./easyeffects ./mpd]; userServices.syncthing.enable = lib.mkDefault true; } diff --git a/homeManagerModules/userServices/mpd/default.nix b/homeManagerModules/userServices/mpd/default.nix new file mode 100644 index 00000000..e4602cd8 --- /dev/null +++ b/homeManagerModules/userServices/mpd/default.nix @@ -0,0 +1,27 @@ +{ + pkgs, + lib, + config, + ... +}: { + options = { + userServices.mpd.enable = + lib.mkEnableOption "MPD user service."; + userServices.mpd.musicDirectory = lib.mkOption { + description = "Name of music directory"; + default = config.xdg.userDirs.music; + type = lib.types.str; + }; + }; + + config = lib.mkIf config.userServices.mpd.enable { + services.mpd = { + enable = true; + musicDirectory = config.userServices.mpd.musicDirectory; + }; + services.mpd-mpris = { + enable = true; + mpd.port = config.services.mpd.network.port; + }; + }; +}