2023-02-20 11:42:13 +01:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2022-12-30 10:02:59 -05:00
|
|
|
cfg = config.plugins.magma-nvim;
|
2023-02-20 11:42:13 +01:00
|
|
|
plugins = import ../plugin-defs.nix {inherit pkgs;};
|
2022-12-30 10:02:59 -05:00
|
|
|
package = pkgs.fetchFromGitHub {
|
2023-02-20 11:42:13 +01:00
|
|
|
owner = "dccsillag";
|
|
|
|
repo = "magma-nvim";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "sha256-IaslJK1F2BxTvZzKGH9OKOl2RICi4d4rSgjliAIAqK4=";
|
|
|
|
};
|
2022-12-30 10:02:59 -05:00
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
plugins.magma-nvim = {
|
|
|
|
enable = mkEnableOption "Enable magma-nvim?";
|
|
|
|
image_provider = mkOption {
|
2023-02-20 11:42:13 +01:00
|
|
|
type = types.enum ["none" "ueberzug" "kitty"];
|
2022-12-30 10:02:59 -05:00
|
|
|
default = "none";
|
|
|
|
example = "ueberzug";
|
2023-02-20 11:42:13 +01:00
|
|
|
description = " This configures how to display images. The following options are available:
|
2022-12-30 10:02:59 -05:00
|
|
|
none -- don't show imagesmagma_image_provider.
|
|
|
|
ueberzug -- use Ueberzug to display images.
|
|
|
|
kitty -- use the Kitty protocol to display images.";
|
|
|
|
};
|
|
|
|
automatically_open_output = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
example = false;
|
2023-02-20 11:42:13 +01:00
|
|
|
description = " If this is true, then whenever you have an active cell its output window will be automatically shown.
|
2022-12-30 10:02:59 -05:00
|
|
|
If this is false, then the output window will only be automatically shown when you've just evaluated the code. So, if you take your cursor out of the cell, and then come back, the output window won't be opened (but the cell will be highlighted). This means that there will be nothing covering your code. You can then open the output window at will using :MagmaShowOutput.";
|
|
|
|
};
|
|
|
|
|
|
|
|
wrap_output = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
example = false;
|
2023-02-20 11:42:13 +01:00
|
|
|
description = " If this is true, then text output in the output window will be wrapped (akin to set wrap).";
|
2022-12-30 10:02:59 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
output_window_borders = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
example = false;
|
2023-02-20 11:42:13 +01:00
|
|
|
description = " If this is true, then the output window will have rounded borders. If it is false, it will have no borders.";
|
2022-12-30 10:02:59 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
cell_highlight_group = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "CursorLine";
|
|
|
|
# example = "";
|
2023-02-20 11:42:13 +01:00
|
|
|
description = " The highlight group to be used for highlighting cells.";
|
2022-12-30 10:02:59 -05:00
|
|
|
};
|
|
|
|
save_path = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2023-02-20 11:42:13 +01:00
|
|
|
description = "Where to save/load with :MagmaSave and :MagmaLoad (with no parameters).
|
2022-12-30 10:02:59 -05:00
|
|
|
The generated file is placed in this directory, with the filename itself being the buffer's name, with % replaced by %% and / replaced by %, and postfixed with the extension .json.";
|
|
|
|
};
|
|
|
|
show_mimetype_debug = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
example = true;
|
2023-02-20 11:42:13 +01:00
|
|
|
description = " If this is true, then before any non-iostream output chunk, Magma shows the mimetypes it received for it.
|
2022-12-30 10:02:59 -05:00
|
|
|
This is meant for debugging and adding new mimetypes.";
|
|
|
|
};
|
|
|
|
package = mkOption {
|
|
|
|
type = types.nullOr types.package;
|
|
|
|
default = null;
|
2023-02-20 11:42:13 +01:00
|
|
|
example = "package = pkgs.fetchFromGitHub {
|
2022-12-30 10:02:59 -05:00
|
|
|
owner = \"WhiteBlackGoose\";
|
|
|
|
repo = \"magma-nvim-goose\";
|
|
|
|
rev = version;
|
|
|
|
sha256 = \"sha256-IaslJK1F2BxTvZzKGH9OKOl2RICi4d4rSgjliAIAqK4=\";} ";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
2023-02-20 11:42:13 +01:00
|
|
|
extraPlugins = [
|
|
|
|
(
|
|
|
|
if cfg.package != null
|
|
|
|
then plugins.magma-nvim.override {src = cfg.package;}
|
|
|
|
else plugins.magma-nvim
|
|
|
|
)
|
|
|
|
];
|
2022-12-30 10:02:59 -05:00
|
|
|
|
|
|
|
globals = {
|
|
|
|
magma_image_provider =
|
|
|
|
mkIf (cfg.image_provider != "none") cfg.image_provider;
|
|
|
|
magma_automatically_open_output =
|
|
|
|
mkIf (!cfg.automatically_open_output) cfg.automatically_open_output;
|
|
|
|
magma_wrap_output = mkIf (!cfg.wrap_output) cfg.wrap_output;
|
|
|
|
magma_output_window_borders =
|
|
|
|
mkIf (!cfg.output_window_borders) cfg.output_window_borders;
|
2023-02-20 11:42:13 +01:00
|
|
|
magma_highlight_group =
|
|
|
|
mkIf (cfg.cell_highlight_group != "CursorLine")
|
2022-12-30 10:02:59 -05:00
|
|
|
cfg.cell_highlight_group;
|
|
|
|
magma_show_mimetype_debug =
|
|
|
|
mkIf cfg.show_mimetype_debug cfg.show_mimetype_debug;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|