diff options
Diffstat (limited to 'user-profiles/mpv')
-rw-r--r-- | user-profiles/mpv/default.nix | 83 |
1 files changed, 83 insertions, 0 deletions
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 @@ | |||
1 | { userName, pkgs, ... }: | ||
2 | { | ||
3 | home-manager.users.${userName}.programs.mpv = { | ||
4 | enable = true; | ||
5 | bindings = { | ||
6 | "CTRL+n" = "af toggle \"lavfi=[dynaudnorm=f=100:g=31:s=20.0]\""; | ||
7 | }; | ||
8 | config = { | ||
9 | ytdl = true; | ||
10 | 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]"; | ||
11 | ytdl-raw-options = "netrc=,mark-watched="; | ||
12 | sub = false; | ||
13 | osd-font = "DejaVu Sans"; | ||
14 | vo = "gpu"; | ||
15 | hwdec = "auto"; | ||
16 | force-window = "yes"; | ||
17 | script-opts = "osc-layout=topbar,vidscale=no,deadzonesize=0.9"; | ||
18 | af = "lavfi=[dynaudnorm=f=100:g=31:s=20.0]"; | ||
19 | }; | ||
20 | scripts = let | ||
21 | reload = pkgs.stdenv.mkDerivation rec { | ||
22 | version = "2b8a719f"; | ||
23 | pname = "reload"; | ||
24 | name = "${pname}-${version}"; | ||
25 | |||
26 | src = pkgs.fetchFromGitHub { | ||
27 | owner = "4e6"; | ||
28 | repo = "mpv-reload"; | ||
29 | rev = "2b8a719fe166d6d42b5f1dd64761f97997b54a86"; | ||
30 | sha256 = "19ycvnwzf8vgv0g63d4k1ll6hlfrd92is9gl8hzfic7w32ycphbg"; | ||
31 | }; | ||
32 | |||
33 | installPhase = '' | ||
34 | install -d $out/share/mpv/scripts | ||
35 | install -m 0644 reload.lua $out/share/mpv/scripts/${passthru.scriptName} | ||
36 | ''; | ||
37 | |||
38 | passthru.scriptName = "reload.lua"; | ||
39 | }; | ||
40 | autosave = pkgs.stdenv.mkDerivation rec { | ||
41 | version = "0bv9wjrq"; | ||
42 | pname = "autosave"; | ||
43 | name = "${pname}-${version}.lua"; | ||
44 | |||
45 | src = pkgs.fetchzip { | ||
46 | url = "https://gist.github.com/Hakkin/5489e511bd6c8068a0fc09304c9c5a82/archive/7a19f7cdb6dd0b1c6878b41e13b244e2503c15fc.zip"; | ||
47 | sha256 = "0bv9wjrqm2ragd7rp8vw768bja2ghascwlljd6rzzf2ybi10fxs2"; | ||
48 | }; | ||
49 | |||
50 | installPhase = '' | ||
51 | install -d $out/share/mpv/scripts | ||
52 | install -m 0644 autosave.lua $out/share/mpv/scripts/${passthru.scriptName} | ||
53 | ''; | ||
54 | |||
55 | passthru.scriptName = "autosave.lua"; | ||
56 | }; | ||
57 | mpris = pkgs.stdenv.mkDerivation rec { | ||
58 | version = "0.4"; | ||
59 | pname = "mpv-mpris"; | ||
60 | name = "${pname}-${version}.so"; | ||
61 | |||
62 | src = pkgs.fetchFromGitHub { | ||
63 | owner = "hoyon"; | ||
64 | repo = "mpv-mpris"; | ||
65 | rev = version; | ||
66 | sha256 = "1fr3jvja8s2gdpx8qyk9r17977flms3qpm8zci62nd9r5wjdvr5i"; | ||
67 | }; | ||
68 | |||
69 | installPhase = '' | ||
70 | install -d $out/share/mpv/scripts | ||
71 | install -m 0644 mpris.so $out/share/mpv/scripts/${passthru.scriptName} | ||
72 | ''; | ||
73 | |||
74 | nativeBuildInputs = with pkgs; [ pkgconfig glib mpv ]; | ||
75 | |||
76 | passthru.scriptName = "mpris.so"; | ||
77 | }; | ||
78 | in [ reload | ||
79 | autosave | ||
80 | mpris | ||
81 | ]; | ||
82 | }; | ||
83 | } | ||