mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
sesh: add module
Sesh is a CLI that helps you create and manage tmux sessions quickly and easily using zoxide. See https://github.com/joshmedeski/sesh for more.
This commit is contained in:
parent
c2cd2a52e0
commit
cb2fd626fe
8 changed files with 135 additions and 0 deletions
|
@ -587,4 +587,10 @@
|
|||
github = "zorrobert";
|
||||
githubId = 118135271;
|
||||
};
|
||||
michaelvanstraten = {
|
||||
name = "Michael van Straten";
|
||||
email = "michael@vanstraten.de";
|
||||
github = "michaelvanstraten";
|
||||
githubId = 50352631;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1703,6 +1703,17 @@ in {
|
|||
one place. See https://github.com/glanceapp/glance for more.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2024-09-01T10:01:13+00:0";
|
||||
message = ''
|
||||
A new module is available: 'programs.sesh'.
|
||||
|
||||
Sesh is a CLI that helps you create and manage tmux sessions quickly
|
||||
and easily using zoxide. See https://github.com/joshmedeski/sesh for
|
||||
more.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -213,6 +213,7 @@ let
|
|||
./programs/scmpuff.nix
|
||||
./programs/script-directory.nix
|
||||
./programs/senpai.nix
|
||||
./programs/sesh.nix
|
||||
./programs/sftpman.nix
|
||||
./programs/sioyek.nix
|
||||
./programs/skim.nix
|
||||
|
|
72
modules/programs/sesh.nix
Normal file
72
modules/programs/sesh.nix
Normal file
|
@ -0,0 +1,72 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.programs.sesh;
|
||||
tomlFormat = pkgs.formats.toml { };
|
||||
in {
|
||||
meta.maintainers = [ maintainers.michaelvanstraten ];
|
||||
|
||||
options.programs.sesh = {
|
||||
enable = mkEnableOption "sesh";
|
||||
package = mkPackageOption pkgs "sesh" { };
|
||||
settings = mkOption {
|
||||
type = types.submodule { freeformType = tomlFormat.type; };
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration settings for sesh, written to `~/.config/sesh/sesh.toml`.
|
||||
|
||||
For more details, refer to the [sesh configuration documentation](https://github.com/joshmedeski/sesh?tab=readme-ov-file#configuration).
|
||||
'';
|
||||
};
|
||||
enableAlias = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable the `s` shell alias for sesh.
|
||||
'';
|
||||
};
|
||||
enableTmuxIntegration = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
description = ''
|
||||
Whether to enable Tmux integration for sesh.
|
||||
'';
|
||||
};
|
||||
tmuxKey = mkOption {
|
||||
type = types.str;
|
||||
default = "s";
|
||||
description = ''
|
||||
The key to bind for the sesh command in tmux.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
# Sesh needs fzf installed by default
|
||||
home.packages = [ cfg.package pkgs.fzf ];
|
||||
home.shellAliases =
|
||||
mkIf cfg.enableAlias { s = "sesh connect $(sesh list | fzf)"; };
|
||||
home.file.".config/sesh/sesh.toml".source =
|
||||
tomlFormat.generate "sesh.toml" cfg.settings;
|
||||
}
|
||||
(mkIf cfg.enableTmuxIntegration {
|
||||
home.packages = [ pkgs.zoxide ];
|
||||
programs.fzf.tmux.enableShellIntegration = true;
|
||||
programs.tmux.extraConfig = ''
|
||||
bind-key "${cfg.tmuxKey}" run-shell "sesh connect \"$(
|
||||
sesh list | fzf-tmux -p 55%,60% \
|
||||
--no-sort --ansi --border-label ' sesh ' --prompt '⚡ ' \
|
||||
--header ' ^a all ^t tmux ^g configs ^x zoxide ^d tmux kill ^f find' \
|
||||
--bind 'tab:down,btab:up' \
|
||||
--bind 'ctrl-a:change-prompt(⚡ )+reload(sesh list)' \
|
||||
--bind 'ctrl-t:change-prompt(🪟 )+reload(sesh list -t)' \
|
||||
--bind 'ctrl-g:change-prompt(⚙️ )+reload(sesh list -c)' \
|
||||
--bind 'ctrl-x:change-prompt(📁 )+reload(sesh list -z)' \
|
||||
--bind 'ctrl-f:change-prompt(🔎 )+reload(fd -H -d 2 -t d -E .Trash . ~)' \
|
||||
--bind 'ctrl-d:execute(tmux kill-session -t {})+change-prompt(⚡ )+reload(sesh list)'
|
||||
)\""
|
||||
'';
|
||||
})
|
||||
]);
|
||||
}
|
|
@ -139,6 +139,7 @@ in import nmtSrc {
|
|||
./modules/programs/sbt
|
||||
./modules/programs/scmpuff
|
||||
./modules/programs/senpai
|
||||
./modules/programs/sesh
|
||||
./modules/programs/sftpman
|
||||
./modules/programs/sioyek
|
||||
./modules/programs/sm64ex
|
||||
|
|
31
tests/modules/programs/sesh/basic-configuration.nix
Normal file
31
tests/modules/programs/sesh/basic-configuration.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.sesh = {
|
||||
enable = true;
|
||||
package = pkgs.writeScriptBin "dummy-polybar" "";
|
||||
settings = {
|
||||
default_session.startup_command = "nvim -c ':Telescope find_files'";
|
||||
session = [
|
||||
{
|
||||
name = "Downloads 📥";
|
||||
path = "~/Downloads";
|
||||
startup_command = "ls";
|
||||
}
|
||||
{
|
||||
name = "tmux config";
|
||||
path = "~/c/dotfiles/.config/tmux";
|
||||
startup_command = "nvim tmux.conf";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/sesh/sesh.toml
|
||||
assertFileContent home-files/.config/sesh/sesh.toml \
|
||||
${./basic-configuration.toml}
|
||||
'';
|
||||
};
|
||||
}
|
12
tests/modules/programs/sesh/basic-configuration.toml
Normal file
12
tests/modules/programs/sesh/basic-configuration.toml
Normal file
|
@ -0,0 +1,12 @@
|
|||
[default_session]
|
||||
startup_command = "nvim -c ':Telescope find_files'"
|
||||
|
||||
[[session]]
|
||||
name = "Downloads 📥"
|
||||
path = "~/Downloads"
|
||||
startup_command = "ls"
|
||||
|
||||
[[session]]
|
||||
name = "tmux config"
|
||||
path = "~/c/dotfiles/.config/tmux"
|
||||
startup_command = "nvim tmux.conf"
|
1
tests/modules/programs/sesh/default.nix
Normal file
1
tests/modules/programs/sesh/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ sesh-basic-configuration = ./basic-configuration.nix; }
|
Loading…
Reference in a new issue