mirror of
https://github.com/nix-community/home-manager
synced 2024-11-19 17:49:45 +01:00
wezterm: add integrations for Bash and Zsh (#3934)
* wezterm: Add `enableBashIntegration` option * wezterm: Add `enableZshIntegration` option
This commit is contained in:
parent
607d8fad96
commit
24d590cc32
8 changed files with 118 additions and 0 deletions
|
@ -7,6 +7,10 @@ let
|
|||
cfg = config.programs.wezterm;
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
|
||||
shellIntegrationStr = ''
|
||||
source "${cfg.package}/etc/profile.d/wezterm.sh"
|
||||
'';
|
||||
|
||||
in {
|
||||
meta.maintainers = [ hm.maintainers.blmhemu ];
|
||||
|
||||
|
@ -79,6 +83,13 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
enableBashIntegration = mkEnableOption "WezTerm's Bash integration." // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
enableZshIntegration = mkEnableOption "WezTerm's Zsh integration." // {
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -99,5 +110,9 @@ in {
|
|||
nameValuePair "wezterm/colors/${name}.toml" {
|
||||
source = tomlFormat.generate "${name}.toml" { colors = value; };
|
||||
}) cfg.colorSchemes;
|
||||
|
||||
programs.bash.initExtra =
|
||||
mkIf cfg.enableBashIntegration shellIntegrationStr;
|
||||
programs.zsh.initExtra = mkIf cfg.enableZshIntegration shellIntegrationStr;
|
||||
};
|
||||
}
|
||||
|
|
14
tests/modules/programs/wezterm/bash-integration-default.nix
Normal file
14
tests/modules/programs/wezterm/bash-integration-default.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.bash.enable = true;
|
||||
|
||||
# Bash integration is enabled by default.
|
||||
programs.wezterm.enable = true;
|
||||
|
||||
test.stubs.wezterm = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContains home-files/.bashrc 'source "@wezterm@/etc/profile.d/wezterm.sh"'
|
||||
'';
|
||||
}
|
16
tests/modules/programs/wezterm/bash-integration-disabled.nix
Normal file
16
tests/modules/programs/wezterm/bash-integration-disabled.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.bash.enable = true;
|
||||
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
enableBashIntegration = false;
|
||||
};
|
||||
|
||||
test.stubs.wezterm = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileNotRegex home-files/.bashrc 'source "@wezterm@/etc/profile.d/wezterm.sh"'
|
||||
'';
|
||||
}
|
16
tests/modules/programs/wezterm/bash-integration-enabled.nix
Normal file
16
tests/modules/programs/wezterm/bash-integration-enabled.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.bash.enable = true;
|
||||
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
};
|
||||
|
||||
test.stubs.wezterm = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContains home-files/.bashrc 'source "@wezterm@/etc/profile.d/wezterm.sh"'
|
||||
'';
|
||||
}
|
|
@ -1,4 +1,12 @@
|
|||
{
|
||||
wezterm-example-setting = ./example-setting.nix;
|
||||
wezterm-empty-setting = ./empty-setting.nix;
|
||||
|
||||
wezterm-bash-integration-default = ./bash-integration-default.nix;
|
||||
wezterm-bash-integration-disabled = ./bash-integration-disabled.nix;
|
||||
wezterm-bash-integration-enabled = ./bash-integration-enabled.nix;
|
||||
|
||||
wezterm-zsh-integration-default = ./zsh-integration-default.nix;
|
||||
wezterm-zsh-integration-disabled = ./zsh-integration-disabled.nix;
|
||||
wezterm-zsh-integration-enabled = ./zsh-integration-enabled.nix;
|
||||
}
|
||||
|
|
15
tests/modules/programs/wezterm/zsh-integration-default.nix
Normal file
15
tests/modules/programs/wezterm/zsh-integration-default.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.zsh.enable = true;
|
||||
|
||||
# Zsh integration is enabled by default.
|
||||
programs.wezterm.enable = true;
|
||||
|
||||
test.stubs.wezterm = { };
|
||||
test.stubs.zsh = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContains home-files/.zshrc 'source "@wezterm@/etc/profile.d/wezterm.sh"'
|
||||
'';
|
||||
}
|
17
tests/modules/programs/wezterm/zsh-integration-disabled.nix
Normal file
17
tests/modules/programs/wezterm/zsh-integration-disabled.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.zsh.enable = true;
|
||||
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
enableZshIntegration = false;
|
||||
};
|
||||
|
||||
test.stubs.wezterm = { };
|
||||
test.stubs.zsh = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileNotRegex home-files/.zshrc 'source "@wezterm@/etc/profile.d/wezterm.sh"'
|
||||
'';
|
||||
}
|
17
tests/modules/programs/wezterm/zsh-integration-enabled.nix
Normal file
17
tests/modules/programs/wezterm/zsh-integration-enabled.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
programs.zsh.enable = true;
|
||||
|
||||
programs.wezterm = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
|
||||
test.stubs.wezterm = { };
|
||||
test.stubs.zsh = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileContains home-files/.zshrc 'source "@wezterm@/etc/profile.d/wezterm.sh"'
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue