Skip to content

Commit 3318aa5

Browse files
committed
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)
1 parent 17121bf commit 3318aa5

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

nixos/doc/manual/release-notes/rl-2505.section.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
- [agorakit](https://github.com/agorakit/agorakit), an organization tool for citizens' collectives. Available with [services.agorakit](#opt-services.agorakit.enable).
2222

23+
- [git-worktree-switcher](https://github.com/mateusauler/git-worktree-switcher), switch between git worktrees with speed. Available as [programs.git-worktree-switcher](#opt-programs.git-worktree-switcher.enable)
24+
2325
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
2426

2527
## Backward Incompatibilities {#sec-release-25.05-incompatibilities}

nixos/modules/module-list.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@
205205
./programs/gdk-pixbuf.nix
206206
./programs/geary.nix
207207
./programs/git.nix
208+
./programs/git-worktree-switcher.nix
208209
./programs/gnome-disks.nix
209210
./programs/gnome-terminal.nix
210211
./programs/gnupg.nix
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
config,
3+
pkgs,
4+
lib,
5+
...
6+
}:
7+
8+
let
9+
cfg = config.programs.git-worktree-switcher;
10+
11+
initScript =
12+
shell:
13+
if (shell == "fish") then
14+
''
15+
${lib.getExe pkgs.git-worktree-switcher} init ${shell} | source
16+
''
17+
else
18+
''
19+
eval "$(${lib.getExe pkgs.git-worktree-switcher} init ${shell})"
20+
'';
21+
in
22+
{
23+
options = {
24+
programs.git-worktree-switcher = {
25+
enable = lib.mkEnableOption "git-worktree-switcher, switch between git worktrees with speed.";
26+
};
27+
};
28+
29+
config = lib.mkIf cfg.enable {
30+
environment.systemPackages = with pkgs; [ git-worktree-switcher ];
31+
32+
programs.bash.interactiveShellInit = initScript "bash";
33+
programs.zsh.interactiveShellInit = lib.optionalString config.programs.zsh.enable (
34+
initScript "zsh"
35+
);
36+
programs.fish.interactiveShellInit = lib.optionalString config.programs.fish.enable (
37+
initScript "fish"
38+
);
39+
};
40+
}

0 commit comments

Comments
 (0)