This commit is contained in:
caandt 2025-01-01 19:18:52 -05:00
parent 651dfa31cc
commit ef2609caab
11 changed files with 75 additions and 1 deletions

View file

@ -37,4 +37,5 @@
ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN || true
'';
};
u.has.jp = true;
}

View file

@ -10,6 +10,11 @@
buildInputs = old.buildInputs ++ [pkgs.xorg.libXcursor];
env.NIX_LDFLAGS = "-lXcursor";
});
ki = super.ki.overrideAttrs (old: {
postInstall = ''
patch $out/bin/ki < ${./ki.diff}
'';
});
})
];
}

11
overlays/ki.diff Normal file
View file

@ -0,0 +1,11 @@
--- a/bin/ki
+++ b/bin/ki
@@ -1,6 +1,8 @@
import re
import sys
from ki import ki
+import ki.maybes as M; M.empty_kirepo = lambda root: (M.F.mksubdir(root, M.Path(M.KI)), M.F.mksubdir(M.EmptyDir(root), M.Path(M.MEDIA)))
+import pathlib as P; PTD = P.Path.__truediv__; P.Path.__truediv__ = lambda a, b: P.Path('/dev/null') if '.gitattributes' in str(PTD(a, b)) else PTD(a, b)
if __name__ == "__main__":
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
sys.exit(ki())

View file

@ -9,6 +9,7 @@ in {
imports = [
./kde
./tmux
./mpv
./nvim
./starship
];

View file

@ -0,0 +1,15 @@
{
config,
lib,
pkgs,
...
}:
lib.mkIf config.u.has.graphical {
programs.mpv = {
enable = true;
scripts = lib.optionals config.u.has.jp [pkgs.mpvScripts.mpvacious];
};
xdg.configFile."mpv/input.conf".source = config.u.lib.lnn "user/config/mpv/input.conf";
xdg.configFile."mpv/mpv.conf".source = config.u.lib.lnn "user/config/mpv/mpv.conf";
xdg.configFile."mpv/script-opts".source = config.u.lib.lnn "user/config/mpv/script-opts";
}

View file

@ -0,0 +1,17 @@
h seek -10
j seek -3 exact
k seek 3 exact
l seek 10
a no-osd sub-seek -1
s set sub-delay 0
d no-osd sub-seek 1
Z add sub-delay +0.05
z add sub-delay -0.05
X sub-step 1
x sub-step -1
mbtn_left cycle pause
wheel_up seek 1
wheel_down seek -1

9
user/config/mpv/mpv.conf Normal file
View file

@ -0,0 +1,9 @@
alang=ja,jp,jpn,japanese,en,eng,english,English,enUS,en-US
slang=ja,jp,jpn,japanese,en,eng,english,English,enUS,en-US
save-position-on-quit=yes
sub-auto=fuzzy
sub-file-paths=ass:srt:sub:subs:subtitles
sub-font="Noto Sans CJK JP Regular"
sub-font-size=40
af-add=scaletempo2
no-keepaspect-window

View file

@ -0,0 +1,9 @@
deck_name=mining
model_name=jp
sentence_field=sent
secondary_field=eng
audio_field=sent_a
image_field=img
autoclip=yes

View file

@ -65,6 +65,7 @@
wine = mkOpt "wine";
prog = mkOpt "prog";
activitywatch = mkOptF "activitywatch";
jp = mkOptF "jp";
};
lib = lib.mkOption {
type = lib.types.attrs;

View file

@ -32,7 +32,6 @@
++ lib.optionals config.u.has.graphical [
(config.u.lib.localHome pkgs.firefox-bin "firefox" "bin/firefox")
alacritty
mpv
nsxiv
rofi
sct
@ -59,5 +58,10 @@
++ lib.optionals config.u.has.wine [
wine
winetricks
]
++ lib.optionals config.u.has.jp [
anki
ki
python312Packages.manga-ocr
];
}

View file

@ -23,6 +23,7 @@ lib.mkIf config.u.has.graphical {
"video/mp4" = media;
"video/mpeg" = media;
"video/x-matroska" = media;
"text/plain" = text;
"application/xml" = text;