feat: shpool

This commit is contained in:
2026-02-01 09:25:51 +08:00
parent b2860d63c5
commit bdddabcd52
6 changed files with 118 additions and 33 deletions

View File

@@ -14,6 +14,9 @@ in
monitor.all.enable = true;
shell.all.enable = true;
vcs.all.enable = true;
shpool.enable = true;
tmux.enable = true;
};
};
}

View File

@@ -75,26 +75,6 @@ in
typos
# keep-sorted end
];
programs.tmux = {
enable = true;
extraConfig = ''
set-option -g mouse on
set-option -a terminal-features ",xterm-256color:RGB,focus,clipboard,usstyle"
'';
plugins = [
(pkgs.tmuxPlugins.mkTmuxPlugin {
pluginName = "tokyo-night-tmux";
rtpFilePath = "tokyo-night.tmux";
version = "legacy";
src = pkgs.fetchFromGitHub {
owner = "janoamaral";
repo = "tokyo-night-tmux";
rev = "16469dfad86846138f594ceec780db27039c06cd";
hash = "sha256-EKCgYan0WayXnkSb2fDJxookdBLW0XBKi2hf/YISwJE=";
};
})
];
};
programs.tealdeer = {
enable = true;
enableAutoUpdates = true;

View File

@@ -5,17 +5,26 @@ in
{
options.my.cli.shell.starship = {
enable = lib.mkEnableOption "starship prompt";
format = lib.mkOption {
type = with lib.types; listOf singleLineStr;
};
};
config = lib.mkIf cfg.enable {
config = lib.mkMerge [
{
my.cli.shell.starship.format = lib.mkOrder 0 [ "$all" ];
}
(lib.mkIf cfg.enable {
my.hm = {
programs.starship = {
enable = true;
settings = lib.recursiveUpdate (with builtins; fromTOML (readFile ./starship-preset.toml)) {
add_newline = false;
nix_shell.disabled = true;
format = lib.concatStringsSep "" cfg.format;
};
};
};
};
})
];
}

41
modules/cli/shpool.nix Normal file
View File

@@ -0,0 +1,41 @@
{
config,
lib,
...
}:
let
cfg = config.my.cli.shpool;
in
{
options.my.cli.shpool = {
enable = lib.mkEnableOption "shpool";
};
config = lib.mkIf cfg.enable {
my.hm = {
services.shpool = {
enable = true;
systemd = true;
settings = {
motd = "never";
prompt_prefix = "";
forward_env = [ "PATH" ];
};
};
# https://github.com/starship/starship/discussions/7260
# programs.starship = {
# settings = {
# custom.shpool = {
# description = "Display current shpool session name";
# when = ''test -n "$SHPOOL_SESSION_NAME"'';
# command = "echo $SHPOOL_SESSION_NAME";
# symbol = " ";
# style = "fg:#dea584";
# format = "[$symbol $output]($style)";
# };
# };
# };
};
# my.cli.shell.starship.format = [ "$starship$character" ];
};
}

53
modules/cli/tmux.nix Normal file
View File

@@ -0,0 +1,53 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.my.cli.tmux;
in
{
options.my.cli.tmux = {
enable = lib.mkEnableOption "tmux";
};
config = lib.mkIf cfg.enable {
my.hm = {
programs.tmux = {
enable = true;
extraConfig = ''
set-option -g mouse on
set-option -a terminal-features ",xterm-256color:RGB,focus,clipboard,usstyle"
'';
plugins = [
(pkgs.tmuxPlugins.mkTmuxPlugin {
pluginName = "tokyo-night-tmux";
rtpFilePath = "tokyo-night.tmux";
version = "legacy";
src = pkgs.fetchFromGitHub {
owner = "janoamaral";
repo = "tokyo-night-tmux";
rev = "16469dfad86846138f594ceec780db27039c06cd";
hash = "sha256-EKCgYan0WayXnkSb2fDJxookdBLW0XBKi2hf/YISwJE=";
};
})
];
};
# https://github.com/starship/starship/discussions/7260
# programs.starship = {
# settings = {
# custom.tmux = {
# description = "Display current tmux session name";
# when = ''test -n "$TMUX"'';
# command = "tmux display-message -p '#S'";
# symbol = " ";
# style = "bold green";
# format = "[$symbol $output]($style)";
# };
# };
# };
};
# my.cli.shell.starship.format = [ "$tmux$character" ];
};
}

View File

@@ -60,11 +60,10 @@ in
programs.starship = {
settings = {
custom = {
# Borrowed from https://github.com/jj-vcs/jj/wiki/Starship/b18afc53417848f58333b24d446b8e2522b42bd2#alternative-prompt
jj = {
ignore_timeout = true;
description = "The current jj status";
# when = "${lib.getExe pkgs.jj-starship} detect";
# command = "${lib.getExe pkgs.jj-starship}";
when = true;
command = ''
jj log --revisions @ --no-graph --ignore-working-copy --color always --limit 1 --template '