From 0dd204ebfe5500714ab82ba80ae6182a2fcc4ebf Mon Sep 17 00:00:00 2001 From: Johannes Frankenau Date: Fri, 30 Jun 2017 17:07:19 +0200 Subject: [PATCH] mpd service: Create playlist directory --- nixos/modules/services/audio/mpd.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/audio/mpd.nix b/nixos/modules/services/audio/mpd.nix index 56af8fe152e0..11628781bbd8 100644 --- a/nixos/modules/services/audio/mpd.nix +++ b/nixos/modules/services/audio/mpd.nix @@ -10,9 +10,11 @@ let gid = config.ids.gids.mpd; cfg = config.services.mpd; + playlistDir = "${cfg.dataDir}/playlists"; + mpdConf = pkgs.writeText "mpd.conf" '' music_directory "${cfg.musicDirectory}" - playlist_directory "${cfg.dataDir}/playlists" + playlist_directory "${playlistDir}" db_file "${cfg.dbFile}" state_file "${cfg.dataDir}/state" sticker_file "${cfg.dataDir}/sticker.sql" @@ -126,7 +128,10 @@ in { description = "Music Player Daemon"; 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 = { User = "${cfg.user}"; PermissionsStartOnly = true;