-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nixos/git-worktree-switcher: init git-worktree-switcher
This module sets up shells so that they work with [git-worktree-switcher](https://github.com/mateusauler/git-worktree-switcher)
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
config, | ||
pkgs, | ||
lib, | ||
... | ||
}: | ||
|
||
let | ||
cfg = config.programs.git-worktree-switcher; | ||
|
||
initScript = | ||
shell: | ||
if (shell == "fish") then | ||
'' | ||
${lib.getExe pkgs.git-worktree-switcher} init ${shell} | source | ||
'' | ||
else | ||
'' | ||
eval "$(${lib.getExe pkgs.git-worktree-switcher} init ${shell})" | ||
''; | ||
in | ||
{ | ||
options = { | ||
programs.git-worktree-switcher = { | ||
enable = lib.mkEnableOption "git-worktree-switcher, switch between git worktrees with speed."; | ||
}; | ||
}; | ||
|
||
config = lib.mkIf cfg.enable { | ||
environment.systemPackages = with pkgs; [ git-worktree-switcher ]; | ||
|
||
programs.bash.interactiveShellInit = initScript "bash"; | ||
programs.zsh.interactiveShellInit = lib.optionalString config.programs.zsh.enable ( | ||
initScript "zsh" | ||
); | ||
programs.fish.interactiveShellInit = lib.optionalString config.programs.fish.enable ( | ||
initScript "fish" | ||
); | ||
}; | ||
} |