1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-31 04:04:32 +00:00
This commit is contained in:
Manuel 2025-03-24 12:37:51 +01:00 committed by GitHub
commit 8dce901734
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 60 additions and 7 deletions

View file

@ -591,6 +591,12 @@
keys =
[{ fingerprint = "75F0 AB7C FE01 D077 AEE6 CAFD 353E 4A18 EE0F AB72"; }];
};
tennox = {
name = "Manu";
github = "tennox";
githubId = 2084639;
matrix = "@tennox:matrix.org";
};
tensor5 = {
github = "tensor5";
githubId = 1545895;

View file

@ -9,7 +9,7 @@ let
zellijCmd = getExe cfg.package;
in {
meta.maintainers = [ hm.maintainers.mainrs ];
meta.maintainers = with hm.maintainers; [ mainrs tennox ];
options.programs.zellij = {
enable = mkEnableOption "zellij";
@ -47,11 +47,31 @@ in {
enableBashIntegration =
lib.hm.shell.mkBashIntegrationOption { inherit config; };
enableFishIntegration =
lib.hm.shell.mkFishIntegrationOption { inherit config; };
enableFishIntegration = lib.hm.shell.mkFishIntegrationOption {
inherit config;
extraDescription =
"Enables both enableFishAutoStart and enableFishCompletions";
};
enableZshIntegration =
lib.hm.shell.mkZshIntegrationOption { inherit config; };
enableFishCompletions = mkEnableOption "load zellij completions" // {
default = true;
};
enableFishAutoStart =
mkEnableOption "autostart zellij in interactive sessions" // {
default = false;
};
autoStartAttachIfSessionExists = mkEnableOption
"attach to the default session, if a zellij session already exists (otherwise starting a new session)"
// {
default = false;
};
autoStartExitShellOnZellijExit =
mkEnableOption "exit the shell when zellij exits." // {
default = false;
};
};
config = mkIf cfg.enable {
@ -77,9 +97,22 @@ in {
eval "$(${zellijCmd} setup --generate-auto-start zsh)"
'');
programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration
(mkOrder 200 ''
eval (${zellijCmd} setup --generate-auto-start fish | string collect)
'');
home.sessionVariables = {
ZELLIJ_AUTO_ATTACH =
if cfg.autoStartAttachIfSessionExists then "true" else "false";
ZELLIJ_AUTO_EXIT =
if cfg.autoStartExitShellOnZellijExit then "true" else "false";
};
programs.fish.interactiveShellInit = mkIf (cfg.enableFishIntegration
|| cfg.enableFishAutoStart || cfg.enableFishCompletions) (mkOrder 200
((if cfg.enableFishIntegration || cfg.enableFishCompletions then ''
eval (${zellijCmd} setup --generate-completion fish | string collect)
'' else
"") + (if cfg.enableFishIntegration || cfg.enableFishAutoStart then ''
eval (${zellijCmd} setup --generate-auto-start fish | string collect)
'' else
"")));
};
}

View file

@ -7,6 +7,10 @@
enableBashIntegration = true;
enableZshIntegration = true;
enableFishIntegration = true;
enableFishAutoStart = true;
enableFishCompletions = true;
autoStartAttachIfSessionExists = true;
autoStartExitShellOnZellijExit = true;
};
bash.enable = true;
zsh.enable = true;
@ -32,5 +36,15 @@
assertFileContains \
home-files/.config/fish/config.fish \
'eval (@zellij@/bin/zellij setup --generate-auto-start fish | string collect)'
assertFileContains \
home-files/.config/fish/config.fish \
'eval (@zellij@/bin/dummy setup --generate-completion fish | string collect)'
assertFileExists home-path/etc/profile.d/hm-session-vars.sh
assertFileContains \
home-path/etc/profile.d/hm-session-vars.sh \
'export ZELLIJ_AUTO_ATTACH="true"'
assertFileContains \
home-path/etc/profile.d/hm-session-vars.sh \
'export ZELLIJ_AUTO_EXIT="true"'
'';
}