make nixos module system-independent
This commit is contained in:
parent
e2d87a1014
commit
753d780ca6
35
flake.nix
35
flake.nix
|
@ -6,8 +6,8 @@
|
|||
utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
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 {
|
||||
pname = repo;
|
||||
|
@ -21,8 +21,8 @@
|
|||
'';
|
||||
passthru = { inherit scriptName; };
|
||||
};
|
||||
in rec {
|
||||
packages.mpv-sub-select = mpvScript {
|
||||
in {
|
||||
packages.sub-select = mpvScript {
|
||||
owner = "CogentRedTester";
|
||||
repo = "mpv-sub-select";
|
||||
rev = "5d2fb7ab73fc0e36d44109e75c9be26bd42084e2";
|
||||
|
@ -30,30 +30,32 @@
|
|||
scriptName = "sub-select.lua";
|
||||
};
|
||||
|
||||
packages.mpv-segment-linking = mpvScript {
|
||||
packages.segment-linking = mpvScript {
|
||||
owner = "CogentRedTester";
|
||||
repo = "mpv-segment-linking";
|
||||
rev = "bb0fdb7961859df57c64b42d75dbbd60a4024e97";
|
||||
sha256 = "1ykl24p96wwka4fillrzni6i0xkk4s2l9zg1scqypcbs5w491qsj";
|
||||
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.mpv-anime = { ... }: {
|
||||
nixpkgs.overlays = final: prev: {
|
||||
mpv = prev.mpv.override {
|
||||
scripts = with packages; [
|
||||
mpv-sub-select
|
||||
mpv-segment-linking
|
||||
];
|
||||
};
|
||||
};
|
||||
nixosModules.default = { pkgs, lib, ... }: {
|
||||
nixpkgs.overlays = [ overlays.default ];
|
||||
|
||||
# needed for mpv segment-linking plugin
|
||||
environment.systemPackages = [
|
||||
pkgs.mkvtoolnix
|
||||
];
|
||||
|
||||
home-manager.sharedModules = [ ({ config, lib, ... }: {
|
||||
home-manager.sharedModules = [ ({ config, ... }: {
|
||||
config = lib.mkIf config.programs.mpv.enable {
|
||||
xdg.configFile."mpv/script-opts/sub-select.json".text = builtins.toJSON [
|
||||
{
|
||||
|
@ -93,6 +95,5 @@
|
|||
};
|
||||
}) ];
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue