nixos-config/configs/home-manager/foo-dogsquared/modules/setups/music.nix
Gabriel Arazas 3324c12d4c
wrapper-manager-fds/modules: overhaul wrapper config
Now, there could be multiple wrappers within the configuration but it
should still result with one derivation unlike the original version.
This could be handy for making package overrides with multiple binaries
(for example, 7Z) while making the interface consistent. This turns out
to be way nicer than I thought which is a good thing.
2024-07-08 21:12:31 +08:00

164 lines
4.0 KiB
Nix

{ config, lib, pkgs, ... }@attrs:
let
userCfg = config.users.foo-dogsquared;
cfg = userCfg.setups.music;
musicDir = config.xdg.userDirs.music;
playlistsDir = "${musicDir}/playlists";
in
{
options.users.foo-dogsquared.setups.music = {
enable = lib.mkEnableOption "foo-dogsquared's music setup";
mpd.enable = lib.mkEnableOption "foo-dogsquared's MPD server setup";
};
config = lib.mkIf cfg.enable (lib.mkMerge [
{
home.packages = with pkgs; [
songrec # SHAZAM!
picard # Graphical beets.
];
wrapper-manager.packages.music-setup = {
wrappers.yt-dlp-audio = {
arg0 = lib.getExe' pkgs.yt-dlp "yt-dlp";
prependArgs = [
"--config-location" ../../config/yt-dlp/audio.conf
];
};
};
# Enable the desktop audio profile for extra auditorial goodies.
suites.desktop.audio = {
enable = lib.mkDefault true;
pipewire.enable = lib.mkDefault true;
};
# My music player setup, completely configured with Nix!
programs.beets = {
enable = true;
settings = {
library = "${musicDir}/library.db";
plugins = [
"acousticbrainz"
"chroma"
"edit"
"export"
"fetchart"
"fromfilename"
"fuzzy"
"mbsync"
"playlist"
"scrub"
"smartplaylist"
];
ignore_hidden = true;
directory = musicDir;
ui.color = true;
import = {
move = true;
link = false;
resume = true;
incremental = true;
group_albums = true;
log = "beets.log";
};
match.ignore_video_tracks = true;
# Plugins configuration.
fuzzy.prefix = "-";
scrub.auto = true;
smartplaylist = {
relative_to = musicDir;
playlist_dir = playlistsDir;
playlists = [
{
name = "all.m3u8";
query = "";
}
{
name = "released-in-$year.m3u8";
query = "year:2000..2023";
}
];
};
};
};
# Add more cleaners.
services.bleachbit.cleaners = [
"audacious.log"
"audacious.cache"
"audacious.mru"
"vlc.memory_dump"
"vlc.mru"
];
}
(lib.mkIf cfg.mpd.enable {
services.mopidy = {
enable = true;
extensionPackages = with pkgs; [
mopidy-funkwhale
mopidy-internetarchive
mopidy-iris
mopidy-local
mopidy-mpd
mopidy-mpris
mopidy-youtube
];
settings = {
http = {
hostname = "127.0.0.1";
port = 6680;
default_app = "iris";
};
file = {
enabled = true;
media_dirs = [
"$XDG_MUSIC_DIR|Music"
"~/library/music|Library"
]
++ lib.optional (attrs?nixosConfig.suites.filesystem.setups.external-hdd.enable)
"/mnt/external-storage/Music|External storage"
++ lib.optional (attrs?nixosConfig.suites.filesystem.setups.archive.enable)
"/mnt/archives/Music|Archive";
};
internetarchive = {
enabled = true;
browse_limit = 150;
search_limit = 150;
collections = [
"fav-foo-dogsquared"
"audio"
"etree"
"audio_music"
"audio_foreign"
];
};
m3u = {
enabled = true;
base_dir = musicDir;
playlists_dir = playlistsDir;
default_encoding = "utf-8";
default_extension = ".m3u8";
};
};
};
# Configure a MPD client.
programs.ncmpcpp = {
enable = true;
mpdMusicDir = musicDir;
};
})
]);
}