Merge pull request #26990 from jfrankenau/mpd-create-playlistDir

mpd service: Create playlist directory
This commit is contained in:
Joachim F 2017-07-02 14:23:53 +01:00 committed by GitHub
commit e4ca35a4f6

View file

@ -10,9 +10,11 @@ let
gid = config.ids.gids.mpd; gid = config.ids.gids.mpd;
cfg = config.services.mpd; cfg = config.services.mpd;
playlistDir = "${cfg.dataDir}/playlists";
mpdConf = pkgs.writeText "mpd.conf" '' mpdConf = pkgs.writeText "mpd.conf" ''
music_directory "${cfg.musicDirectory}" music_directory "${cfg.musicDirectory}"
playlist_directory "${cfg.dataDir}/playlists" playlist_directory "${playlistDir}"
db_file "${cfg.dbFile}" db_file "${cfg.dbFile}"
state_file "${cfg.dataDir}/state" state_file "${cfg.dataDir}/state"
sticker_file "${cfg.dataDir}/sticker.sql" sticker_file "${cfg.dataDir}/sticker.sql"
@ -126,7 +128,10 @@ in {
description = "Music Player Daemon"; description = "Music Player Daemon";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
preStart = "mkdir -p ${cfg.dataDir} && chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir}"; preStart = ''
mkdir -p "${cfg.dataDir}" && chown -R ${cfg.user}:${cfg.group} "${cfg.dataDir}"
mkdir -p "${playlistDir}" && chown -R ${cfg.user}:${cfg.group} "${playlistDir}"
'';
serviceConfig = { serviceConfig = {
User = "${cfg.user}"; User = "${cfg.user}";
PermissionsStartOnly = true; PermissionsStartOnly = true;