plugins/vimtex: use package options for extraPackages

This commit is contained in:
Austin Horstman 2024-09-14 10:58:13 -05:00
parent ff3fee3ae5
commit 9832cb86fb
No known key found for this signature in database
2 changed files with 34 additions and 7 deletions

View file

@ -11,8 +11,6 @@ helpers.vim-plugin.mkVimPlugin {
maintainers = [ maintainers.GaetanLepage ]; maintainers = [ maintainers.GaetanLepage ];
extraPackages = [ pkgs.pstree ];
# TODO introduced 2024-02-20: remove 2024-04-20 # TODO introduced 2024-02-20: remove 2024-04-20
deprecateExtraConfig = true; deprecateExtraConfig = true;
optionsRenamedToSettings = [ "viewMethod" ]; optionsRenamedToSettings = [ "viewMethod" ];
@ -62,6 +60,22 @@ helpers.vim-plugin.mkVimPlugin {
"scheme-medium" "scheme-medium"
]; ];
}; };
xdotoolPackage = lib.mkPackageOption pkgs "xdotool" {
nullable = true;
};
zathuraPackage = lib.mkPackageOption pkgs "zathura" {
nullable = true;
};
mupdfPackage = lib.mkPackageOption pkgs "mupdf" {
nullable = true;
};
pstreePackage = lib.mkPackageOption pkgs "pstree" {
nullable = true;
};
}; };
extraConfig = cfg: { extraConfig = cfg: {
@ -73,16 +87,20 @@ helpers.vim-plugin.mkVimPlugin {
extraPackages = extraPackages =
let let
# xdotool does not exist on darwin # xdotool does not exist on darwin
xdotool = optional pkgs.stdenv.isLinux pkgs.xdotool; xdotool = optional pkgs.stdenv.isLinux cfg.xdotoolPackage;
viewerPackages = viewerPackages =
{ {
general = xdotool; general = xdotool;
zathura = xdotool ++ [ pkgs.zathura ]; zathura = xdotool ++ [ cfg.zathuraPackage ];
zathura_simple = [ pkgs.zathura ]; zathura_simple = [ cfg.zathuraPackage ];
mupdf = xdotool ++ [ pkgs.mupdf ]; mupdf = xdotool ++ [ cfg.mupdfPackage ];
} }
.${cfg.settings.view_method} or [ ]; .${cfg.settings.view_method} or [ ];
in in
[ cfg.texlivePackage ] ++ viewerPackages; [
cfg.pstreePackage
cfg.texlivePackage
]
++ viewerPackages;
}; };
} }

View file

@ -69,4 +69,13 @@ in
}; };
}; };
}; };
no-packages = {
plugins.vimtex = disableTexlivePackageOnDarwin // {
enable = true;
xdotoolPackage = null;
zathuraPackage = null;
mupdfPackage = null;
};
};
} }