move sub-select.json to global config, remove home-manager dependency
This commit is contained in:
parent
753d780ca6
commit
0047c5f9be
80
flake.nix
80
flake.nix
|
@ -9,12 +9,13 @@
|
||||||
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 }: pkgs.stdenvNoCC.mkDerivation {
|
mpvScript = { owner, repo, rev, sha256, scriptName, patches ? [] }: 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}
|
||||||
|
@ -28,6 +29,9 @@
|
||||||
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 {
|
||||||
|
@ -55,45 +59,41 @@
|
||||||
pkgs.mkvtoolnix
|
pkgs.mkvtoolnix
|
||||||
];
|
];
|
||||||
|
|
||||||
home-manager.sharedModules = [ ({ config, ... }: {
|
environment.etc."mpv/script-opts/sub-select.json".text = builtins.toJSON [
|
||||||
config = lib.mkIf config.programs.mpv.enable {
|
{
|
||||||
xdg.configFile."mpv/script-opts/sub-select.json".text = builtins.toJSON [
|
alang = "j[ap]n?";
|
||||||
{
|
slang = [ "eng?" "und" ];
|
||||||
alang = "j[ap]n?";
|
blacklist = [ "sign" ];
|
||||||
slang = [ "eng?" "und" ];
|
condition = "not sub.forced";
|
||||||
blacklist = [ "sign" ];
|
}
|
||||||
condition = "not sub.forced";
|
{
|
||||||
}
|
alang = "eng?";
|
||||||
{
|
slang = "forced";
|
||||||
alang = "eng?";
|
}
|
||||||
slang = "forced";
|
{
|
||||||
}
|
alang = "eng?";
|
||||||
{
|
slang = "eng?";
|
||||||
alang = "eng?";
|
whitelist = [ "sign" "song" ];
|
||||||
slang = "eng?";
|
}
|
||||||
whitelist = [ "sign" "song" ];
|
{
|
||||||
}
|
alang = [ "eng?" "no" ];
|
||||||
{
|
slang = "no";
|
||||||
alang = [ "eng?" "no" ];
|
}
|
||||||
slang = "no";
|
{
|
||||||
}
|
alang = "*";
|
||||||
{
|
slang = "eng?";
|
||||||
alang = "*";
|
condition = "not sub.forced";
|
||||||
slang = "eng?";
|
}
|
||||||
condition = "not sub.forced";
|
{
|
||||||
}
|
alang = "*";
|
||||||
{
|
slang = "und";
|
||||||
alang = "*";
|
condition = "not sub.forced";
|
||||||
slang = "und";
|
}
|
||||||
condition = "not sub.forced";
|
{
|
||||||
}
|
alang = "*";
|
||||||
{
|
slang = "forced";
|
||||||
alang = "*";
|
}
|
||||||
slang = "forced";
|
];
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}) ];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
13
sub-select-path.patch
Normal file
13
sub-select-path.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
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