dotfiles/home/apps/media.nix

93 lines
2.5 KiB
Nix
Raw Normal View History

2023-02-10 07:46:37 +01:00
{
config,
lib,
pkgs,
...
}: let
2023-06-04 01:51:55 +02:00
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
2023-02-10 07:46:37 +01:00
in {
programs.mpv.enable = isLinux;
xdg.mimeApps.defaultApplications = {
"video/mp4" = "mpv.desktop";
"video/webm" = "mpv.desktop";
};
programs.zathura.enable = true;
xdg.mimeApps.defaultApplications."application/pdf" = "zathura.desktop";
programs.ncmpcpp = {
enable = true;
settings."lyrics_directory" = "${config.xdg.dataHome}/ncmpcpp";
bindings =
lib.mapAttrsToList (key: command: {inherit key command;})
{
"j" = "scroll_down";
"k" = "scroll_up";
"J" = ["select_item" "scroll_down"];
"K" = ["select_item" "scroll_up"];
"h" = "previous_column";
"l" = "next_column";
"ctrl-b" = "page_up";
"ctrl-u" = "page_up";
"ctrl-f" = "page_down";
"ctrl-d" = "page_down";
"g" = "move_home";
"G" = "move_end";
"n" = "next_found_item";
"N" = "previous_found_item";
};
};
2023-06-04 01:51:55 +02:00
services = {
discord-applemusic-rich-presence.enable = isDarwin;
mpd.enable = isLinux;
mpdris2 = {
enable = isLinux;
multimediaKeys = true;
notifications = true;
};
mpd-discord-rpc = {
2023-06-04 01:51:55 +02:00
enable = isLinux;
settings = {
format = {
state = "$artist";
large_image = "https://cdn.discordapp.com/emojis/743725086262951957.gif";
large_text = "$album";
small_image = "https://cdn.discordapp.com/emojis/743723149455261717.png";
small_text = "pretty fucking based";
};
};
};
2023-06-04 01:51:55 +02:00
mpd-mpris.enable = isLinux;
};
2023-03-09 14:27:13 +01:00
launchd.agents.mpd = {
enable = true;
config = let
mpdConf = pkgs.writeText "mpd.conf" (let
baseDir = config.xdg.dataHome + "/mpd";
in ''
music_directory "${config.xdg.userDirs.music}"
playlist_directory "${baseDir}/playlists"
db_file "${baseDir}/database"
pid_file "${baseDir}/mpd.pid"
state_file "${baseDir}/state"
log_file "${baseDir}/log"
auto_update "yes"
port "6600"
bind_to_address "127.0.0.1"
audio_output {
2023-05-14 09:27:30 +02:00
type "osx"
name "CoreAudio"
mixer_type "software"
2023-03-09 14:27:13 +01:00
}
'');
in {
2023-04-27 09:30:26 +02:00
ProgramArguments = ["${pkgs.mpd}/bin/mpd" "--no-daemon" "${mpdConf}"];
2023-03-09 14:27:13 +01:00
KeepAlive = true;
RunAtLoad = true;
StandardErrorPath = "${config.xdg.cacheHome}/mpd.log";
StandardOutPath = "${config.xdg.cacheHome}/mpd.log";
};
};
}