{ lib, pkgs, config, ... }: let cfg = config.grimmShared; viewer_pkg = pkgs.zathura; viewer_def = lib.optionalString cfg.graphical ''pdf_viewer = "${lib.getExe pkgs.zathura}",''; in { config = with cfg; lib.mkIf (enable && tooling.enable && tooling.lilypond) { environment.systemPackages = with pkgs; [ lilypond-with-fonts ] ++ lib.optional graphical viewer_pkg; environment.sessionVariables = { LYEDITOR = "${lib.getExe pkgs.neovim-remote} -s +:'dr %(file)s | call cursor(%(line)s,%(char)s+1)'"; }; grimmShared.sound.midi = true; grimmShared.tooling.nvim = { extraLuaRC = lib.singleton '' require('nvls').setup({ lilypond = { options = { ${viewer_def} }, }, latex = { options = { ${viewer_def} }, }, player = { options = { fluidsynth_flags = { "/run/current-system/sw/share/soundfonts/FluidR3_GM2-2.sf2" } } } }) ''; }; grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ nvim-lilypond-suite ]; }; options.grimmShared.tooling.lilypond = lib.mkEnableOption "enable lilypond tooling"; }