So i have my configuration.nix
as below:
services.mpd = {
enable = true;
musicDirectory = "/home/peal/Music";
extraConfig = ''
audio_output {
type "pulse"
name "My PulseAudio" # this can be whatever you want
}
'';
user = "peal";
network.listenAddress = "any"; # if you want to allow non-localhost connections
startWhenNeeded = true; # systemd feature: only start MPD service upon connection to its socket
};
and of course, nix generate a config file for mpd:
cat mpd.conf
# This file was automatically generated by NixOS. Edit mpd's configuration
# via NixOS' configuration.nix, as this file will be rewritten upon mpd's
# restart.
music_directory "/home/peal/Music"
playlist_directory "/var/lib/mpd/playlists"
db_file "/var/lib/mpd/tag_cache"
state_file "/var/lib/mpd/state"
sticker_file "/var/lib/mpd/sticker.sql"
audio_output {
type "pulse"
name "My PulseAudio" # this can be whatever you want
}
everything looks fine, so it should be reading musics from the Music
directory in my home directory
However, as i do ncmpc
and ctrl - u
to update the database, nothing happened.
My Music dir is just 2 big folder, each store a bunch of album, each album is stored in their own folder. To help visualize it, here’s the example file hierarchy:
└── Music
├── category1
│ ├── album1
│ │ ├── track1.flac
│ │ ├── track2.flac
│ │ ├── track3.flac
│ │ └── track4.flac
│ ├── album2
│ │ ├── track1.flac
│ │ ├── track2.flac
│ │ ├── track3.flac
│ │ └── track4.flac
│ ├── album3
│ │ ├── track1.flac
│ │ ├── track2.flac
│ │ ├── track3.flac
│ │ └── track4.flac
│ └── album4
│ ├── track1.flac
│ ├── track2.flac
│ ├── track3.flac
│ └── track4.flac
└── category2
├── album1
│ ├── track1.flac
│ ├── track2.flac
│ ├── track3.flac
│ └── track4.flac
├── album2
│ ├── track1.flac
│ ├── track2.flac
│ ├── track3.flac
│ └── track4.flac
├── album3
│ ├── track1.flac
│ ├── track2.flac
│ ├── track3.flac
│ └── track4.flac
└── album4
├── track1.flac
├── track2.flac
├── track3.flac
└── track4.flac