mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-11 17:39:37 +08:00
mpd: Add support for darwin (#6517)
This commit is contained in:
@@ -14,6 +14,9 @@ let
|
||||
${lib.optionalString (cfg.dbFile != null) ''
|
||||
db_file "${cfg.dbFile}"
|
||||
''}
|
||||
${lib.optionalString (pkgs.stdenv.hostPlatform.isDarwin) ''
|
||||
log_file "${config.home.homeDirectory}/Library/Logs/mpd/log.txt"
|
||||
''}
|
||||
state_file "${cfg.dataDir}/state"
|
||||
sticker_file "${cfg.dataDir}/sticker.sql"
|
||||
|
||||
@@ -114,7 +117,7 @@ in {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Enable systemd socket activation.
|
||||
Enable systemd socket activation. This is only supported on Linux.
|
||||
'';
|
||||
};
|
||||
|
||||
@@ -155,10 +158,6 @@ in {
|
||||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "services.mpd" pkgs lib.platforms.linux)
|
||||
];
|
||||
|
||||
services.mpd = mkMerge [
|
||||
(mkIf (versionAtLeast config.home.stateVersion "22.11"
|
||||
&& config.xdg.userDirs.enable) {
|
||||
@@ -170,7 +169,7 @@ in {
|
||||
})
|
||||
];
|
||||
|
||||
systemd.user.services.mpd = {
|
||||
systemd.user.services.mpd = lib.mkIf pkgs.stdenv.hostPlatform.isLinux {
|
||||
Unit = mkMerge [
|
||||
{
|
||||
Description = "Music Player Daemon";
|
||||
@@ -214,7 +213,17 @@ in {
|
||||
Install = { WantedBy = [ "sockets.target" ]; };
|
||||
};
|
||||
|
||||
launchd.agents.mpd = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin {
|
||||
enable = true;
|
||||
config = {
|
||||
ProgramArguments =
|
||||
[ (lib.getExe cfg.package) "--no-daemon" "${mpdConf}" ]
|
||||
++ cfg.extraArgs;
|
||||
KeepAlive = true;
|
||||
ProcessType = "Interactive";
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ music_directory "/my/music/dir"
|
||||
playlist_directory "/home/hm-user/.local/share/mpd/playlists"
|
||||
db_file "/home/hm-user/.local/share/mpd/tag_cache"
|
||||
|
||||
|
||||
state_file "/home/hm-user/.local/share/mpd/state"
|
||||
sticker_file "/home/hm-user/.local/share/mpd/sticker.sql"
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ music_directory "/home/hm-user/Music"
|
||||
playlist_directory "/home/hm-user/.local/share/mpd/playlists"
|
||||
db_file "/home/hm-user/.local/share/mpd/tag_cache"
|
||||
|
||||
|
||||
state_file "/home/hm-user/.local/share/mpd/state"
|
||||
sticker_file "/home/hm-user/.local/share/mpd/sticker.sql"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user