From 4a3d2a8ddaf4e546df360656bc54b2947bdb890b Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 3 Jan 2021 00:55:29 +0100 Subject: gkleen@sif: import --- user-profiles/mpv/default.nix | 83 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 user-profiles/mpv/default.nix (limited to 'user-profiles/mpv') diff --git a/user-profiles/mpv/default.nix b/user-profiles/mpv/default.nix new file mode 100644 index 00000000..ae791668 --- /dev/null +++ b/user-profiles/mpv/default.nix @@ -0,0 +1,83 @@ +{ userName, pkgs, ... }: +{ + home-manager.users.${userName}.programs.mpv = { + enable = true; + bindings = { + "CTRL+n" = "af toggle \"lavfi=[dynaudnorm=f=100:g=31:s=20.0]\""; + }; + config = { + ytdl = true; + ytdl-format = "bestvideo[width<=2560][height<=1440][fps<=60][protocol!=http_dash_segments]+bestaudio[protocol!=http_dash_segments]/best[width<=2560][height<=1440][fps<=60][protocol!=http_dash_segments]/best[protocol!=http_dash_segments]"; + ytdl-raw-options = "netrc=,mark-watched="; + sub = false; + osd-font = "DejaVu Sans"; + vo = "gpu"; + hwdec = "auto"; + force-window = "yes"; + script-opts = "osc-layout=topbar,vidscale=no,deadzonesize=0.9"; + af = "lavfi=[dynaudnorm=f=100:g=31:s=20.0]"; + }; + scripts = let + reload = pkgs.stdenv.mkDerivation rec { + version = "2b8a719f"; + pname = "reload"; + name = "${pname}-${version}"; + + src = pkgs.fetchFromGitHub { + owner = "4e6"; + repo = "mpv-reload"; + rev = "2b8a719fe166d6d42b5f1dd64761f97997b54a86"; + sha256 = "19ycvnwzf8vgv0g63d4k1ll6hlfrd92is9gl8hzfic7w32ycphbg"; + }; + + installPhase = '' + install -d $out/share/mpv/scripts + install -m 0644 reload.lua $out/share/mpv/scripts/${passthru.scriptName} + ''; + + passthru.scriptName = "reload.lua"; + }; + autosave = pkgs.stdenv.mkDerivation rec { + version = "0bv9wjrq"; + pname = "autosave"; + name = "${pname}-${version}.lua"; + + src = pkgs.fetchzip { + url = "https://gist.github.com/Hakkin/5489e511bd6c8068a0fc09304c9c5a82/archive/7a19f7cdb6dd0b1c6878b41e13b244e2503c15fc.zip"; + sha256 = "0bv9wjrqm2ragd7rp8vw768bja2ghascwlljd6rzzf2ybi10fxs2"; + }; + + installPhase = '' + install -d $out/share/mpv/scripts + install -m 0644 autosave.lua $out/share/mpv/scripts/${passthru.scriptName} + ''; + + passthru.scriptName = "autosave.lua"; + }; + mpris = pkgs.stdenv.mkDerivation rec { + version = "0.4"; + pname = "mpv-mpris"; + name = "${pname}-${version}.so"; + + src = pkgs.fetchFromGitHub { + owner = "hoyon"; + repo = "mpv-mpris"; + rev = version; + sha256 = "1fr3jvja8s2gdpx8qyk9r17977flms3qpm8zci62nd9r5wjdvr5i"; + }; + + installPhase = '' + install -d $out/share/mpv/scripts + install -m 0644 mpris.so $out/share/mpv/scripts/${passthru.scriptName} + ''; + + nativeBuildInputs = with pkgs; [ pkgconfig glib mpv ]; + + passthru.scriptName = "mpris.so"; + }; + in [ reload + autosave + mpris + ]; + }; +} -- cgit v1.2.3