summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2024-08-24 19:51:35 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2024-08-24 19:51:35 +0200
commit3b97bf86dd0a510bb196eac5230bc3e03240b91d (patch)
tree8afe2b7e31320692f540a31000063b5c53fe8c10
parent8d51d790fd650126c83567ec68c965a3da5d9d3f (diff)
downloadnixos-3b97bf86dd0a510bb196eac5230bc3e03240b91d.tar
nixos-3b97bf86dd0a510bb196eac5230bc3e03240b91d.tar.gz
nixos-3b97bf86dd0a510bb196eac5230bc3e03240b91d.tar.bz2
nixos-3b97bf86dd0a510bb196eac5230bc3e03240b91d.tar.xz
nixos-3b97bf86dd0a510bb196eac5230bc3e03240b91d.zip
...
-rw-r--r--accounts/gkleen@sif/default.nix4
-rw-r--r--accounts/gkleen@sif/hyprland.nix2
-rw-r--r--user-profiles/mpv/default.nix161
3 files changed, 100 insertions, 67 deletions
diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix
index 61769adb..87c7a437 100644
--- a/accounts/gkleen@sif/default.nix
+++ b/accounts/gkleen@sif/default.nix
@@ -201,7 +201,9 @@ in {
201 gpu-api = "vulkan"; 201 gpu-api = "vulkan";
202 }; 202 };
203 203
204 zsh.initExtra = "source ${./zshrc}"; 204 zsh.initExtra = ''
205 source ${./zshrc}
206 '';
205 zsh.dirHashes = let 207 zsh.dirHashes = let
206 flakeHashes = mapAttrs' (n: v: nameValuePair (inputNames.${n} or n) (toString v)) flakeInputs; 208 flakeHashes = mapAttrs' (n: v: nameValuePair (inputNames.${n} or n) (toString v)) flakeInputs;
207 inputNames = { 209 inputNames = {
diff --git a/accounts/gkleen@sif/hyprland.nix b/accounts/gkleen@sif/hyprland.nix
index 50b019ca..052f35b0 100644
--- a/accounts/gkleen@sif/hyprland.nix
+++ b/accounts/gkleen@sif/hyprland.nix
@@ -88,7 +88,7 @@ in {
88 kb_layout = "us,us"; 88 kb_layout = "us,us";
89 kb_variant = "dvp,"; 89 kb_variant = "dvp,";
90 kb_model = ""; 90 kb_model = "";
91 kb_options = "compose:caps,grp:win_space_toggle,grp:alt_shift_toggle"; 91 kb_options = "compose:caps,grp:win_space_toggle";
92 kb_rules = ""; 92 kb_rules = "";
93 93
94 follow_mouse = 1; 94 follow_mouse = 1;
diff --git a/user-profiles/mpv/default.nix b/user-profiles/mpv/default.nix
index 065b44ac..8fc38edd 100644
--- a/user-profiles/mpv/default.nix
+++ b/user-profiles/mpv/default.nix
@@ -3,6 +3,102 @@
3 home-manager.users.${userName} = { 3 home-manager.users.${userName} = {
4 programs.mpv = { 4 programs.mpv = {
5 enable = true; 5 enable = true;
6 package = pkgs.symlinkJoin {
7 inherit (pkgs.mpv) name;
8 paths = [(pkgs.mpv.override {
9 scripts = [
10 (pkgs.stdenv.mkDerivation (sources.mpv-reload // rec {
11 installPhase = ''
12 install -d $out/share/mpv/scripts
13 install -m 0644 reload.lua $out/share/mpv/scripts/${passthru.scriptName}
14 '';
15
16 passthru.scriptName = "reload.lua";
17 }))
18 (pkgs.stdenv.mkDerivation (sources.mpv-createchapter // rec {
19 installPhase = ''
20 install -d $out/share/mpv/scripts
21 install -m 0644 createchapter.lua $out/share/mpv/scripts/${passthru.scriptName}
22 '';
23
24 passthru.scriptName = "createchapter.lua";
25 }))
26 (pkgs.stdenv.mkDerivation (sources.mpv-autosave // rec {
27 installPhase = ''
28 install -d $out/share/mpv/scripts
29 install -m 0644 autosave.lua $out/share/mpv/scripts/${passthru.scriptName}
30 '';
31
32 passthru.scriptName = "autosave.lua";
33 }))
34 (pkgs.stdenv.mkDerivation (sources.mpv-mpris // rec {
35 installPhase = ''
36 install -d $out/share/mpv/scripts
37 install -m 0644 mpris.so $out/share/mpv/scripts/${passthru.scriptName}
38 '';
39
40 nativeBuildInputs = with pkgs; [ pkg-config glib mpv ffmpeg.dev ];
41
42 passthru.scriptName = "mpris.so";
43 }))
44 (pkgs.stdenv.mkDerivation (sources.mpv-chapterskip // rec {
45 installPhase = ''
46 install -d $out/share/mpv/scripts
47 install -m 0644 chapterskip.lua $out/share/mpv/scripts/${passthru.scriptName}
48 '';
49
50 passthru.scriptName = "chapterskip.lua";
51 }))
52 (pkgs.stdenv.mkDerivation (sources.mpv-subselect // rec {
53 installPhase = ''
54 install -d $out/share/mpv/scripts
55 install -m 0644 sub-select.lua $out/share/mpv/scripts/${passthru.scriptName}
56 '';
57
58 passthru.scriptName = "sub-select.lua";
59 }))
60 (pkgs.stdenv.mkDerivation (sources.mpv-youtube-quality // rec {
61 patches = [
62 (pkgs.fetchpatch { url = "https://github.com/jgreco/mpv-youtube-quality/pull/31.patch"; hash = "sha256-2aTTkW48uRe8XC1ZQ8J5T9sUmZ5F3YAoYCMxqEs2AY8="; })
63 (pkgs.fetchpatch { url = "https://github.com/jgreco/mpv-youtube-quality/pull/20.patch"; hash = "sha256-X5BwDsxziYbeiQvrBt8+IS+6oH1i0LvaaYtugL790gg="; })
64 ];
65
66 installPhase = ''
67 install -d $out/share/mpv/scripts
68 install -m 0644 youtube-quality.lua $out/share/mpv/scripts/${passthru.scriptName}
69 '';
70
71 passthru.scriptName = "youtube-quality.lua";
72 }))
73 ];
74 })];
75 buildInputs = [ pkgs.makeWrapper ];
76 postBuild = ''
77 makeWrapper $out/bin/mpv $out/bin/mpvrm \
78 --add-flags "--script=${pkgs.writeTextDir "share/mpv/scripts/delete.lua" ''
79 del_path = '''
80 do_del = false
81
82 mp.add_hook('on_load', 50, function()
83 del_path = '''
84 end)
85 mp.add_hook('on_unload', 50, function()
86 del_path = mp.get_property('path')
87 end)
88
89 mp.add_key_binding('Ctrl+q', function()
90 do_del = true
91 mp.commandv('quit', '4')
92 end)
93 mp.register_event('end-file', function(params)
94 if (params.reason == 'eof' or (do_del and params.reason == 'quit')) and del_path ~= ''' then
95 print('deleting: '..del_path)
96 os.remove(del_path)
97 end
98 end)
99 ''}/share/mpv/scripts/delete.lua"
100 '';
101 };
6 bindings = { 102 bindings = {
7 # "CTRL+n" = "af toggle \"lavfi=[dynaudnorm=f=100:g=31:s=20.0]\""; 103 # "CTRL+n" = "af toggle \"lavfi=[dynaudnorm=f=100:g=31:s=20.0]\"";
8 }; 104 };
@@ -56,71 +152,6 @@
56 ]; 152 ];
57 watch-later-options = lib.concatStringsSep "," [ "start" ]; 153 watch-later-options = lib.concatStringsSep "," [ "start" ];
58 }; 154 };
59 scripts = [
60 (pkgs.stdenv.mkDerivation (sources.mpv-reload // rec {
61 installPhase = ''
62 install -d $out/share/mpv/scripts
63 install -m 0644 reload.lua $out/share/mpv/scripts/${passthru.scriptName}
64 '';
65
66 passthru.scriptName = "reload.lua";
67 }))
68 (pkgs.stdenv.mkDerivation (sources.mpv-createchapter // rec {
69 installPhase = ''
70 install -d $out/share/mpv/scripts
71 install -m 0644 createchapter.lua $out/share/mpv/scripts/${passthru.scriptName}
72 '';
73
74 passthru.scriptName = "createchapter.lua";
75 }))
76 (pkgs.stdenv.mkDerivation (sources.mpv-autosave // rec {
77 installPhase = ''
78 install -d $out/share/mpv/scripts
79 install -m 0644 autosave.lua $out/share/mpv/scripts/${passthru.scriptName}
80 '';
81
82 passthru.scriptName = "autosave.lua";
83 }))
84 (pkgs.stdenv.mkDerivation (sources.mpv-mpris // rec {
85 installPhase = ''
86 install -d $out/share/mpv/scripts
87 install -m 0644 mpris.so $out/share/mpv/scripts/${passthru.scriptName}
88 '';
89
90 nativeBuildInputs = with pkgs; [ pkg-config glib mpv ffmpeg.dev ];
91
92 passthru.scriptName = "mpris.so";
93 }))
94 (pkgs.stdenv.mkDerivation (sources.mpv-chapterskip // rec {
95 installPhase = ''
96 install -d $out/share/mpv/scripts
97 install -m 0644 chapterskip.lua $out/share/mpv/scripts/${passthru.scriptName}
98 '';
99
100 passthru.scriptName = "chapterskip.lua";
101 }))
102 (pkgs.stdenv.mkDerivation (sources.mpv-subselect // rec {
103 installPhase = ''
104 install -d $out/share/mpv/scripts
105 install -m 0644 sub-select.lua $out/share/mpv/scripts/${passthru.scriptName}
106 '';
107
108 passthru.scriptName = "sub-select.lua";
109 }))
110 (pkgs.stdenv.mkDerivation (sources.mpv-youtube-quality // rec {
111 patches = [
112 (pkgs.fetchpatch { url = "https://github.com/jgreco/mpv-youtube-quality/pull/31.patch"; hash = "sha256-2aTTkW48uRe8XC1ZQ8J5T9sUmZ5F3YAoYCMxqEs2AY8="; })
113 (pkgs.fetchpatch { url = "https://github.com/jgreco/mpv-youtube-quality/pull/20.patch"; hash = "sha256-X5BwDsxziYbeiQvrBt8+IS+6oH1i0LvaaYtugL790gg="; })
114 ];
115
116 installPhase = ''
117 install -d $out/share/mpv/scripts
118 install -m 0644 youtube-quality.lua $out/share/mpv/scripts/${passthru.scriptName}
119 '';
120
121 passthru.scriptName = "youtube-quality.lua";
122 }))
123 ];
124 }; 155 };
125 156
126 xdg.configFile."mpv/youtube-dl".source = "${pkgs.yt-dlp}/bin/yt-dlp"; 157 xdg.configFile."mpv/youtube-dl".source = "${pkgs.yt-dlp}/bin/yt-dlp";