diff options
Diffstat (limited to 'user-profiles/mpv')
-rw-r--r-- | user-profiles/mpv/default.nix | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/user-profiles/mpv/default.nix b/user-profiles/mpv/default.nix new file mode 100644 index 00000000..6b0ea076 --- /dev/null +++ b/user-profiles/mpv/default.nix | |||
@@ -0,0 +1,85 @@ | |||
1 | { config, 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=,cookies=${config.home-manager.users.${userName}.home.homeDirectory}/Downloads/cookies.txt"; | ||
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 = "744c3ee6"; | ||
42 | pname = "autosave"; | ||
43 | name = "${pname}-${version}.lua"; | ||
44 | |||
45 | src = pkgs.fetchzip { | ||
46 | url = "https://gist.github.com/CyberShadow/2f71a97fb85ed42146f6d9f522bc34ef/archive/744c3ee61d2f0a8e9bb4e308dec6897215ae4704.zip"; | ||
47 | hash = "sha256-yxA8wgzdS7SyKLoNTWN87ShsBfPKUflbOu4Y0jS2G3I="; | ||
48 | # url = "https://gist.github.com/Hakkin/5489e511bd6c8068a0fc09304c9c5a82/archive/7a19f7cdb6dd0b1c6878b41e13b244e2503c15fc.zip"; | ||
49 | # sha256 = "0bv9wjrqm2ragd7rp8vw768bja2ghascwlljd6rzzf2ybi10fxs2"; | ||
50 | }; | ||
51 | |||
52 | installPhase = '' | ||
53 | install -d $out/share/mpv/scripts | ||
54 | install -m 0644 autosave.lua $out/share/mpv/scripts/${passthru.scriptName} | ||
55 | ''; | ||
56 | |||
57 | passthru.scriptName = "autosave.lua"; | ||
58 | }; | ||
59 | mpris = pkgs.stdenv.mkDerivation rec { | ||
60 | version = "0.4"; | ||
61 | pname = "mpv-mpris"; | ||
62 | name = "${pname}-${version}.so"; | ||
63 | |||
64 | src = pkgs.fetchFromGitHub { | ||
65 | owner = "hoyon"; | ||
66 | repo = "mpv-mpris"; | ||
67 | rev = version; | ||
68 | sha256 = "1fr3jvja8s2gdpx8qyk9r17977flms3qpm8zci62nd9r5wjdvr5i"; | ||
69 | }; | ||
70 | |||
71 | installPhase = '' | ||
72 | install -d $out/share/mpv/scripts | ||
73 | install -m 0644 mpris.so $out/share/mpv/scripts/${passthru.scriptName} | ||
74 | ''; | ||
75 | |||
76 | nativeBuildInputs = with pkgs; [ pkgconfig glib mpv ]; | ||
77 | |||
78 | passthru.scriptName = "mpris.so"; | ||
79 | }; | ||
80 | in [ reload | ||
81 | autosave | ||
82 | mpris | ||
83 | ]; | ||
84 | }; | ||
85 | } | ||