Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plugins/wezterm: init #2597

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/maintainers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,10 @@
githubId = 38228372;
name = "Katie Janzen";
};
samos667 = {
email = "[email protected]";
github = "samos667";
githubId = 50653464;
name = "samos667";
};
}
3 changes: 3 additions & 0 deletions plugins/by-name/molten/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,12 @@ mkVimPlugin {
[
"none"
"image.nvim"
"wezterm"
]
''
How images are displayed.

If set to `"wezterm"`, `plugins.wezterm.enable` must be true.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not adding a warning to check this ? This is usually what we do.

'';

open_cmd = helpers.mkNullOrOption types.str ''
Expand Down
39 changes: 39 additions & 0 deletions plugins/by-name/wezterm/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
lib,
pkgs,
...
}:
let
inherit (lib.nixvim) defaultNullOpts;
in
lib.nixvim.neovim-plugin.mkNeovimPlugin {
name = "wezterm";
originalName = "wezterm.nvim";
package = "wezterm-nvim";
MattSturgeon marked this conversation as resolved.
Show resolved Hide resolved

maintainers = [ lib.maintainers.samos667 ];

extraOptions = {
weztermPackage = lib.mkPackageOption pkgs "wezterm" {
nullable = true;
default = null;
example = [ "wezterm" ];
};
Comment on lines +17 to +21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the best default here? The package or null?

I'm assuming most users who enable this plugin will already have wezterm installed 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually we set the package.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would achieve that:

Suggested change
weztermPackage = lib.mkPackageOption pkgs "wezterm" {
nullable = true;
default = null;
example = [ "wezterm" ];
};
weztermPackage = lib.mkPackageOption pkgs "wezterm" {
nullable = true;
};

Is there any reason not to do that here?

};

settingsOptions = {
create_commands = defaultNullOpts.mkBool true ''
Whether to create plugin commands.
'';
};

settingsExample = {
create_commands = false;
};

extraConfig = cfg: {
extraPackages = [
cfg.weztermPackage
];
};
}
23 changes: 23 additions & 0 deletions tests/test-sources/plugins/by-name/wezterm/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
empty =
{ pkgs, ... }:
{
plugins.wezterm = {
enable = true;
weztermPackage = pkgs.wezterm;
};
};

defaults =
{ pkgs, ... }:
{
plugins.wezterm = {
enable = true;
weztermPackage = pkgs.wezterm;

settings = {
create_commands = true;
};
};
};
}