Compare commits

..

No commits in common. "6c5c7f2b0004bd89a0428a2e9fa68a0e064dc3ab" and "3217f26b19b8323d3aa8c50276777aa3cc0e9d59" have entirely different histories.

2 changed files with 72 additions and 42 deletions

View file

@ -9,12 +9,13 @@
outputs = { self, nixpkgs, utils }: let
packages = utils.lib.eachDefaultSystem (system: let
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;
version = builtins.substring 0 6 rev;
src = pkgs.fetchFromGitHub {
inherit owner repo rev sha256;
};
inherit patches;
dontBuild = true;
installPhase = ''
install -Dm644 ${scriptName} $out/share/mpv/scripts/${scriptName}
@ -28,6 +29,9 @@
rev = "5d2fb7ab73fc0e36d44109e75c9be26bd42084e2";
sha256 = "0dyh2kyvivj81lrkyqhc3czmi9hqjkh7xg8dqjnnr3kh3yn62dpi";
scriptName = "sub-select.lua";
patches = [
./sub-select-path.patch
];
};
packages.segment-linking = mpvScript {
@ -42,8 +46,25 @@
packages // rec {
overlays.default = final: prev: let
newScripts = packages.packages.${prev.system};
in {
mpv = prev.mpv.override { scripts = builtins.attrValues newScripts; };
in rec {
mpv-unwrapped = prev.mpv-unwrapped.overrideAttrs (oldAttrs:
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;
};
@ -55,9 +76,7 @@
pkgs.mkvtoolnix
];
home-manager.sharedModules = [ ({ config, ... }: {
config = lib.mkIf config.programs.mpv.enable {
xdg.configFile."mpv/script-opts/sub-select.json".text = builtins.toJSON [
environment.etc."mpv/script-opts/sub-select.json".text = builtins.toJSON [
{
alang = "j[ap]n?";
slang = [ "eng?" "und" ];
@ -93,7 +112,5 @@
}
];
};
}) ];
};
};
}

13
sub-select-path.patch Normal file
View 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)