Make directories configurable using a patch
This commit is contained in:
parent
2bedd41d83
commit
dc2de9334d
5 changed files with 77 additions and 38 deletions
|
@ -11,36 +11,48 @@ let
|
|||
cfg = config.homeManagerModules.cli.tmux-sessionizer;
|
||||
in
|
||||
{
|
||||
options.homeManagerModules.cli.tmux-sessionizer.enable = mkEnableOption "Enable tmux-sessionizer";
|
||||
options.homeManagerModules.cli.tmux-sessionizer = {
|
||||
enable = mkEnableOption "Enable tmux-sessionizer";
|
||||
|
||||
directories = mkOption {
|
||||
default = [ config.home.homeDirectory ];
|
||||
type = types.listOf types.str;
|
||||
description = "List of directories for tmux-sessionizer to use.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
tmux-sessionizer
|
||||
];
|
||||
|
||||
xdg.configFile."tmux-sessionizer/default".source = "${
|
||||
pkgs.writeShellApplication {
|
||||
name = ".tmux-sessionizer";
|
||||
xdg.configFile = {
|
||||
"tmux-sessionizer/default".source = "${
|
||||
pkgs.writeShellApplication {
|
||||
name = ".tmux-sessionizer";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
tmux
|
||||
];
|
||||
runtimeInputs = with pkgs; [
|
||||
tmux
|
||||
];
|
||||
|
||||
text = ''
|
||||
set +o errexit
|
||||
set +o nounset
|
||||
text = ''
|
||||
set +o errexit
|
||||
set +o nounset
|
||||
|
||||
if [[ "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/os" || "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/personal" ]]; then
|
||||
if [[ "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/os" || "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/personal" ]]; then
|
||||
clear
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
tmux new-window -d -n scratch
|
||||
nvim .
|
||||
clear
|
||||
'';
|
||||
}
|
||||
}/bin/.tmux-sessionizer";
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
tmux new-window -d -n scratch
|
||||
nvim .
|
||||
clear
|
||||
'';
|
||||
}
|
||||
}/bin/.tmux-sessionizer";
|
||||
"tmux-sessionizer/directories".text = builtins.concatStringsSep "\n" cfg.directories;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue