Flatten modules
This commit is contained in:
parent
ab5ae74dda
commit
d1a58fec56
86 changed files with 64 additions and 50 deletions
64
modules/home-manager/tmux-sessionizer.nix
Normal file
64
modules/home-manager/tmux-sessionizer.nix
Normal file
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.features.cli.tmux-sessionizer;
|
||||
in
|
||||
{
|
||||
options.features.cli.tmux-sessionizer = {
|
||||
enable = mkEnableOption "Enable tmux-sessionizer";
|
||||
enableDmenuIntegration = mkEnableOption "Enable dmenu integration";
|
||||
|
||||
searchPaths = mkOption {
|
||||
default = [ config.home.homeDirectory ];
|
||||
type = types.listOf types.str;
|
||||
description = "List of search paths for tmux-sessionizer to use.";
|
||||
};
|
||||
|
||||
# TODO: add TS_EXTRA_SEARCH_PATHS.
|
||||
# TODO: add TS_MAX_DEPTH.
|
||||
# TODO: add TS_SESSION_COMMANDS once I figure out what they're for.
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
tmux-sessionizer
|
||||
];
|
||||
|
||||
home.file.".tmux-sessionizer".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" || "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/work" ]]; then
|
||||
clear
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
tmux new-window -d -n scratch
|
||||
nvim .
|
||||
clear
|
||||
'';
|
||||
}
|
||||
}/bin/.tmux-sessionizer";
|
||||
|
||||
xdg.configFile."tmux-sessionizer/tmux-sessionizer.conf".text = ''
|
||||
TS_SEARCH_PATHS=(${builtins.concatStringsSep " " cfg.searchPaths})
|
||||
TS_SESSION_COMMANDS=(nvim .)
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue