mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 15:11:25 +00:00
nixos/mpd: allow configuring playlist directory (#28252)
This commit is contained in:
parent
61aa254204
commit
ae02dd2d0a
@ -10,11 +10,9 @@ 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 "${playlistDir}"
|
playlist_directory "${cfg.playlistDirectory}"
|
||||||
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"
|
||||||
@ -57,11 +55,21 @@ in {
|
|||||||
musicDirectory = mkOption {
|
musicDirectory = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
default = "${cfg.dataDir}/music";
|
default = "${cfg.dataDir}/music";
|
||||||
|
defaultText = ''''${dataDir}/music'';
|
||||||
description = ''
|
description = ''
|
||||||
The directory where mpd reads music from.
|
The directory where mpd reads music from.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
playlistDirectory = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "${cfg.dataDir}/playlists";
|
||||||
|
defaultText = ''''${dataDir}/playlists'';
|
||||||
|
description = ''
|
||||||
|
The directory where mpd stores playlists.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
@ -120,6 +128,7 @@ in {
|
|||||||
dbFile = mkOption {
|
dbFile = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "${cfg.dataDir}/tag_cache";
|
default = "${cfg.dataDir}/tag_cache";
|
||||||
|
defaultText = ''''${dataDir}/tag_cache'';
|
||||||
description = ''
|
description = ''
|
||||||
The path to MPD's database.
|
The path to MPD's database.
|
||||||
'';
|
'';
|
||||||
@ -153,7 +162,7 @@ in {
|
|||||||
|
|
||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -p "${cfg.dataDir}" && chown -R ${cfg.user}:${cfg.group} "${cfg.dataDir}"
|
mkdir -p "${cfg.dataDir}" && chown -R ${cfg.user}:${cfg.group} "${cfg.dataDir}"
|
||||||
mkdir -p "${playlistDir}" && chown -R ${cfg.user}:${cfg.group} "${playlistDir}"
|
mkdir -p "${cfg.playlistDirectory}" && chown -R ${cfg.user}:${cfg.group} "${cfg.playlistDirectory}"
|
||||||
'';
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = "${cfg.user}";
|
User = "${cfg.user}";
|
||||||
|
Loading…
Reference in New Issue
Block a user