Compare commits
5 commits
3217f26b19
...
6c5c7f2b00
Author | SHA1 | Date | |
---|---|---|---|
xenofem | 6c5c7f2b00 | ||
xenofem | be5208856b | ||
xenofem | 681260bdb6 | ||
xenofem | 4f950c6af9 | ||
xenofem | 32ab8865b6 |
101
flake.nix
101
flake.nix
|
@ -9,13 +9,12 @@
|
||||||
outputs = { self, nixpkgs, utils }: let
|
outputs = { self, nixpkgs, utils }: let
|
||||||
packages = utils.lib.eachDefaultSystem (system: let
|
packages = utils.lib.eachDefaultSystem (system: let
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
mpvScript = { owner, repo, rev, sha256, scriptName, patches ? [] }: pkgs.stdenvNoCC.mkDerivation {
|
mpvScript = { owner, repo, rev, sha256, scriptName }: pkgs.stdenvNoCC.mkDerivation {
|
||||||
pname = repo;
|
pname = repo;
|
||||||
version = builtins.substring 0 6 rev;
|
version = builtins.substring 0 6 rev;
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
inherit owner repo rev sha256;
|
inherit owner repo rev sha256;
|
||||||
};
|
};
|
||||||
inherit patches;
|
|
||||||
dontBuild = true;
|
dontBuild = true;
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
install -Dm644 ${scriptName} $out/share/mpv/scripts/${scriptName}
|
install -Dm644 ${scriptName} $out/share/mpv/scripts/${scriptName}
|
||||||
|
@ -29,9 +28,6 @@
|
||||||
rev = "5d2fb7ab73fc0e36d44109e75c9be26bd42084e2";
|
rev = "5d2fb7ab73fc0e36d44109e75c9be26bd42084e2";
|
||||||
sha256 = "0dyh2kyvivj81lrkyqhc3czmi9hqjkh7xg8dqjnnr3kh3yn62dpi";
|
sha256 = "0dyh2kyvivj81lrkyqhc3czmi9hqjkh7xg8dqjnnr3kh3yn62dpi";
|
||||||
scriptName = "sub-select.lua";
|
scriptName = "sub-select.lua";
|
||||||
patches = [
|
|
||||||
./sub-select-path.patch
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
packages.segment-linking = mpvScript {
|
packages.segment-linking = mpvScript {
|
||||||
|
@ -46,25 +42,8 @@
|
||||||
packages // rec {
|
packages // rec {
|
||||||
overlays.default = final: prev: let
|
overlays.default = final: prev: let
|
||||||
newScripts = packages.packages.${prev.system};
|
newScripts = packages.packages.${prev.system};
|
||||||
in rec {
|
in {
|
||||||
mpv-unwrapped = prev.mpv-unwrapped.overrideAttrs (oldAttrs:
|
mpv = prev.mpv.override { scripts = builtins.attrValues newScripts; };
|
||||||
if oldAttrs ? wafConfigureFlags
|
|
||||||
then {
|
|
||||||
wafConfigureFlags = oldAttrs.wafConfigureFlags ++ [
|
|
||||||
"--confloaddir=/etc/mpv"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
else if oldAttrs ? mesonFlags
|
|
||||||
then {
|
|
||||||
mesonFlags = oldAttrs.mesonFlags ++ [
|
|
||||||
"-Dsysconfdir=/etc"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
else oldAttrs
|
|
||||||
);
|
|
||||||
mpv = prev.wrapMpv mpv-unwrapped {
|
|
||||||
scripts = builtins.attrValues newScripts;
|
|
||||||
};
|
|
||||||
mpvScripts = prev.mpvScripts // newScripts;
|
mpvScripts = prev.mpvScripts // newScripts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,41 +55,45 @@
|
||||||
pkgs.mkvtoolnix
|
pkgs.mkvtoolnix
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.etc."mpv/script-opts/sub-select.json".text = builtins.toJSON [
|
home-manager.sharedModules = [ ({ config, ... }: {
|
||||||
{
|
config = lib.mkIf config.programs.mpv.enable {
|
||||||
alang = "j[ap]n?";
|
xdg.configFile."mpv/script-opts/sub-select.json".text = builtins.toJSON [
|
||||||
slang = [ "eng?" "und" ];
|
{
|
||||||
blacklist = [ "sign" ];
|
alang = "j[ap]n?";
|
||||||
condition = "not sub.forced";
|
slang = [ "eng?" "und" ];
|
||||||
}
|
blacklist = [ "sign" ];
|
||||||
{
|
condition = "not sub.forced";
|
||||||
alang = "eng?";
|
}
|
||||||
slang = "forced";
|
{
|
||||||
}
|
alang = "eng?";
|
||||||
{
|
slang = "forced";
|
||||||
alang = "eng?";
|
}
|
||||||
slang = "eng?";
|
{
|
||||||
whitelist = [ "sign" "song" ];
|
alang = "eng?";
|
||||||
}
|
slang = "eng?";
|
||||||
{
|
whitelist = [ "sign" "song" ];
|
||||||
alang = [ "eng?" "no" ];
|
}
|
||||||
slang = "no";
|
{
|
||||||
}
|
alang = [ "eng?" "no" ];
|
||||||
{
|
slang = "no";
|
||||||
alang = "*";
|
}
|
||||||
slang = "eng?";
|
{
|
||||||
condition = "not sub.forced";
|
alang = "*";
|
||||||
}
|
slang = "eng?";
|
||||||
{
|
condition = "not sub.forced";
|
||||||
alang = "*";
|
}
|
||||||
slang = "und";
|
{
|
||||||
condition = "not sub.forced";
|
alang = "*";
|
||||||
}
|
slang = "und";
|
||||||
{
|
condition = "not sub.forced";
|
||||||
alang = "*";
|
}
|
||||||
slang = "forced";
|
{
|
||||||
}
|
alang = "*";
|
||||||
];
|
slang = "forced";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}) ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
diff --git a/sub-select.lua b/sub-select.lua
|
|
||||||
index f61025b..1d8edc8 100644
|
|
||||||
--- a/sub-select.lua
|
|
||||||
+++ b/sub-select.lua
|
|
||||||
@@ -73,7 +73,7 @@ local function type_check(val, t, required)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function setup_prefs()
|
|
||||||
- local file = assert(io.open(mp.command_native({"expand-path", o.config}) .. "/sub-select.json"))
|
|
||||||
+ local file = assert(io.open(mp.command_native({"expand-path", o.config .. "/sub-select.json"})))
|
|
||||||
local json = file:read("*all")
|
|
||||||
file:close()
|
|
||||||
prefs = utils.parse_json(json)
|
|
Loading…
Reference in a new issue