feat(media): give up on mpv
This commit is contained in:
parent
8eeeef79c5
commit
aedac3c339
1 changed files with 34 additions and 79 deletions
|
@ -1,92 +1,47 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux;
|
||||
|
||||
applemusic = rec {
|
||||
name = "apple-music-via-chrome";
|
||||
script = pkgs.writeShellScriptBin name ''
|
||||
exec ${pkgs.google-chrome}/bin/${pkgs.google-chrome.meta.mainProgram} \
|
||||
--app=https://music.apple.com \
|
||||
--no-crash-upload \
|
||||
--no-default-browser-check \
|
||||
--no-first-run \
|
||||
"$@"
|
||||
'';
|
||||
desktopItem = pkgs.makeDesktopItem {
|
||||
inherit name;
|
||||
exec = name;
|
||||
icon = pkgs.fetchurl {
|
||||
name = "Apple Music-icon-2016.png";
|
||||
url = "https://assets.nflxext.com/us/ffe/siteui/common/icons/nficon2016.png";
|
||||
sha256 = "sha256-c0H3uLCuPA2krqVZ78MfC1PZ253SkWZP3PfWGP2V7Yo=";
|
||||
meta.license = lib.licenses.unfree;
|
||||
};
|
||||
desktopName = "Apple Music via Google Chrome";
|
||||
startupNotify = true;
|
||||
};
|
||||
pkg = pkgs.symlinkJoin {
|
||||
inherit name;
|
||||
paths = [script desktopItem];
|
||||
};
|
||||
};
|
||||
in {
|
||||
programs.mpv.enable = isLinux;
|
||||
programs.zathura.enable = isLinux;
|
||||
home.packages = lib.mkIf isLinux [applemusic.pkg];
|
||||
|
||||
services.discord-applemusic-rich-presence.enable = isDarwin;
|
||||
|
||||
xdg.mimeApps.defaultApplications = {
|
||||
"application/pdf" = "zathura.desktop";
|
||||
"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";
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
discord-applemusic-rich-presence.enable = isDarwin;
|
||||
mpd.enable = isLinux;
|
||||
mpdris2 = {
|
||||
enable = isLinux;
|
||||
multimediaKeys = true;
|
||||
notifications = true;
|
||||
};
|
||||
mpd-discord-rpc = {
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
mpd-mpris.enable = isLinux;
|
||||
};
|
||||
|
||||
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 {
|
||||
type "osx"
|
||||
name "CoreAudio"
|
||||
mixer_type "software"
|
||||
}
|
||||
'');
|
||||
in {
|
||||
ProgramArguments = ["${pkgs.mpd}/bin/mpd" "--no-daemon" "${mpdConf}"];
|
||||
KeepAlive = true;
|
||||
RunAtLoad = true;
|
||||
StandardErrorPath = "${config.xdg.cacheHome}/mpd.log";
|
||||
StandardOutPath = "${config.xdg.cacheHome}/mpd.log";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue