58 lines
1.2 KiB
Nix
58 lines
1.2 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
|
|
with lib;
|
|
|
|
let
|
|
cfg = config.features.cli.tmux-sessionizer;
|
|
in
|
|
{
|
|
options.features.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";
|
|
|
|
runtimeInputs = with pkgs; [
|
|
tmux
|
|
];
|
|
|
|
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
|
|
clear
|
|
|
|
return
|
|
fi
|
|
|
|
tmux new-window -d -n scratch
|
|
nvim .
|
|
clear
|
|
'';
|
|
}
|
|
}/bin/.tmux-sessionizer";
|
|
|
|
"tmux-sessionizer/directories".text = builtins.concatStringsSep "\n" cfg.directories;
|
|
};
|
|
};
|
|
}
|