mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-24 06:33:42 +00:00
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)
This commit is contained in:
parent
17121bf620
commit
3318aa52de
@ -20,6 +20,8 @@
|
||||
|
||||
- [agorakit](https://github.com/agorakit/agorakit), an organization tool for citizens' collectives. Available with [services.agorakit](#opt-services.agorakit.enable).
|
||||
|
||||
- [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)
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
## Backward Incompatibilities {#sec-release-25.05-incompatibilities}
|
||||
|
@ -205,6 +205,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
|
||||
|
40
nixos/modules/programs/git-worktree-switcher.nix
Normal file
40
nixos/modules/programs/git-worktree-switcher.nix
Normal file
@ -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"
|
||||
);
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user