mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
plugins/faust: init
This commit is contained in:
parent
7e51c72da2
commit
d44b33a1ea
2 changed files with 64 additions and 0 deletions
59
plugins/by-name/faust/default.nix
Normal file
59
plugins/by-name/faust/default.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ lib, pkgs, ... }:
|
||||
let
|
||||
globalPrefix = "faust";
|
||||
in
|
||||
lib.nixvim.plugins.mkNeovimPlugin {
|
||||
name = "faust";
|
||||
packPathName = "faust-nvim";
|
||||
package = "faust-nvim";
|
||||
|
||||
maintainers = [ lib.maintainers.GaetanLepage ];
|
||||
|
||||
# Configuration is done through globals vim.g.faust*
|
||||
hasSettings = false;
|
||||
extraOptions = {
|
||||
faustPackage = lib.mkOption {
|
||||
type = with lib.types; nullOr package;
|
||||
default = pkgs.faust;
|
||||
defaultText = lib.literalExpression "pkgs.faust";
|
||||
description = ''
|
||||
If non-null, the provided package will be used to initialize the plugin's settings:
|
||||
```nix
|
||||
settings = {
|
||||
_examples_dir = "''${cfg.faustPackage}/share/faust/examples";
|
||||
"2appls_dir" = "''${cfg.faustPackage}/bin";
|
||||
lib_dir = "''${cfg.faustPackage}/share/faust/";
|
||||
};
|
||||
```
|
||||
'';
|
||||
};
|
||||
|
||||
settings = lib.nixvim.plugins.vim.mkSettingsOption {
|
||||
inherit globalPrefix;
|
||||
name = "faust";
|
||||
example = {
|
||||
_examples_dir = "/usr/share/faust/examples";
|
||||
"2appls_dir" = "/bin/";
|
||||
lib_dir = "/usr/share/faust/";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
callSetup = false;
|
||||
extraConfig = cfg: {
|
||||
plugins.faust = {
|
||||
luaConfig.content = ''
|
||||
require('faust-nvim')
|
||||
require('faust-nvim').load_snippets()
|
||||
'';
|
||||
|
||||
# Explicitly provide the paths to the faust components
|
||||
settings = lib.mkIf (cfg.faustPackage != null) {
|
||||
_examples_dir = lib.mkDefault "${cfg.faustPackage}/share/faust/examples";
|
||||
"2appls_dir" = lib.mkDefault (lib.getBin cfg.faustPackage);
|
||||
lib_dir = lib.mkDefault "${cfg.faustPackage}/share/faust/";
|
||||
};
|
||||
};
|
||||
globals = lib.nixvim.applyPrefixToAttrs globalPrefix cfg.settings;
|
||||
};
|
||||
}
|
5
tests/test-sources/plugins/by-name/faust/default.nix
Normal file
5
tests/test-sources/plugins/by-name/faust/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
empty = {
|
||||
plugins.faust.enable = true;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue