Skip to content

Commit

Permalink
nixos/git-worktree-switcher: init git-worktree-switcher
Browse files Browse the repository at this point in the history
This module sets up shells so that they work with
[git-worktree-switcher](https://github.com/mateusauler/git-worktree-switcher)
  • Loading branch information
jiriks74 committed Nov 13, 2024
1 parent 678ce1d commit ca7c8e1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@

- [Zapret](https://github.com/bol-van/zapret), a DPI bypass tool. Available as [services.zapret](option.html#opt-services.zapret.enable).

- [git-worktree-switcher](https://github.com/mateusauler/git-worktree-switcher), switch between git worktrees with speed.

## Backward Incompatibilities {#sec-release-24.11-incompatibilities}

- Nixpkgs now requires Nix 2.3.17 or newer to allow for zstd compressed binary artifacts.
Expand Down
36 changes: 36 additions & 0 deletions nixos/modules/programs/git-worktree-switcher.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
config,
pkgs,
lib,
...
}:

let
prg = config.programs;
cfg = prg.git-worktree-switcher;

bashInitScript = ''
eval "$(command ${pkgs.git-worktree-switcher}/bin/wt init bash)"
'';
zshInitScript = ''
eval "$(command ${pkgs.git-worktree-switcher}/bin/wt init zsh)"
'';
fishInitScript = ''
eval "$(command ${pkgs.git-worktree-switcher}/bin/wt init zsh)"
'';
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 = bashInitScript;
programs.zsh.interactiveShellInit = lib.mkIf prg.zsh.enable zshInitScript;
programs.fish.interactiveShellInit = lib.mkIf prg.fish.enable fishInitScript;
};
}

0 comments on commit ca7c8e1

Please sign in to comment.