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 27, 2024
1 parent 55b89b5 commit 24c1a26
Show file tree
Hide file tree
Showing 3 changed files with 33 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 @@ -201,6 +201,8 @@

- [Glances](https://github.com/nicolargo/glances), an open-source system cross-platform monitoring tool. Available as [services.glances](option.html#opt-services.glances).

- [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)

## 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
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
./programs/gdk-pixbuf.nix
./programs/geary.nix
./programs/git.nix
./programs/git-worktree-switcher.nix
./programs/gnome-disks.nix
./programs/gnome-terminal.nix
./programs/gnupg.nix
Expand Down
30 changes: 30 additions & 0 deletions nixos/modules/programs/git-worktree-switcher.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
config,
pkgs,
lib,
...
}:

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

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

0 comments on commit 24c1a26

Please sign in to comment.