diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index feb22e7a5cc76..6025908a94c09 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -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. diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 07d1d880a074b..0c2b4bce0e264 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -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 diff --git a/nixos/modules/programs/git-worktree-switcher.nix b/nixos/modules/programs/git-worktree-switcher.nix new file mode 100644 index 0000000000000..ffe8192868612 --- /dev/null +++ b/nixos/modules/programs/git-worktree-switcher.nix @@ -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; + }; +}