Compare commits

..

3 commits

View file

@ -6,8 +6,8 @@
utils.url = "github:numtide/flake-utils"; utils.url = "github:numtide/flake-utils";
}; };
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system: outputs = { self, nixpkgs, utils }: let
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 }: pkgs.stdenvNoCC.mkDerivation {
pname = repo; pname = repo;
@ -21,8 +21,8 @@
''; '';
passthru = { inherit scriptName; }; passthru = { inherit scriptName; };
}; };
in rec { in {
packages.mpvScripts.sub-select = mpvScript { packages.sub-select = mpvScript {
owner = "CogentRedTester"; owner = "CogentRedTester";
repo = "mpv-sub-select"; repo = "mpv-sub-select";
rev = "5d2fb7ab73fc0e36d44109e75c9be26bd42084e2"; rev = "5d2fb7ab73fc0e36d44109e75c9be26bd42084e2";
@ -30,30 +30,32 @@
scriptName = "sub-select.lua"; scriptName = "sub-select.lua";
}; };
packages.mpvScripts.segment-linking = mpvScript { packages.segment-linking = mpvScript {
owner = "CogentRedTester"; owner = "CogentRedTester";
repo = "mpv-segment-linking"; repo = "mpv-segment-linking";
rev = "bb0fdb7961859df57c64b42d75dbbd60a4024e97"; rev = "bb0fdb7961859df57c64b42d75dbbd60a4024e97";
sha256 = "1ykl24p96wwka4fillrzni6i0xkk4s2l9zg1scqypcbs5w491qsj"; sha256 = "1ykl24p96wwka4fillrzni6i0xkk4s2l9zg1scqypcbs5w491qsj";
scriptName = "segment-linking.lua"; scriptName = "segment-linking.lua";
}; };
});
in
packages // rec {
overlays.default = final: prev: let
newScripts = packages.packages.${prev.system};
in {
mpv = prev.mpv.override { scripts = builtins.attrValues newScripts; };
mpvScripts = prev.mpvScripts // newScripts;
};
nixosModules.default = { ... }: { nixosModules.default = { pkgs, lib, ... }: {
nixpkgs.overlays = final: prev: { nixpkgs.overlays = [ overlays.default ];
mpv = prev.mpv.override {
scripts = with packages.mpvScripts; [
sub-select
segment-linking
];
};
};
# needed for mpv segment-linking plugin # needed for mpv segment-linking plugin
environment.systemPackages = [ environment.systemPackages = [
pkgs.mkvtoolnix pkgs.mkvtoolnix
]; ];
home-manager.sharedModules = [ ({ config, lib, ... }: { home-manager.sharedModules = [ ({ config, ... }: {
config = lib.mkIf config.programs.mpv.enable { config = lib.mkIf config.programs.mpv.enable {
xdg.configFile."mpv/script-opts/sub-select.json".text = builtins.toJSON [ xdg.configFile."mpv/script-opts/sub-select.json".text = builtins.toJSON [
{ {
@ -93,6 +95,5 @@
}; };
}) ]; }) ];
}; };
} };
);
} }