grimm-nixos-laptop/common/tooling/lilypond.nix

58 lines
1.3 KiB
Nix
Raw Normal View History

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