mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
tmux: format using nixfmt
This commit is contained in:
parent
e377556818
commit
34327e067f
2 changed files with 52 additions and 60 deletions
1
format
1
format
|
@ -29,7 +29,6 @@ find . -name '*.nix' \
|
||||||
! -path ./modules/programs/bash.nix \
|
! -path ./modules/programs/bash.nix \
|
||||||
! -path ./modules/programs/gpg.nix \
|
! -path ./modules/programs/gpg.nix \
|
||||||
! -path ./modules/programs/ssh.nix \
|
! -path ./modules/programs/ssh.nix \
|
||||||
! -path ./modules/programs/tmux.nix \
|
|
||||||
! -path ./modules/programs/zsh.nix \
|
! -path ./modules/programs/zsh.nix \
|
||||||
! -path ./modules/services/gpg-agent.nix \
|
! -path ./modules/services/gpg-agent.nix \
|
||||||
! -path ./modules/services/mpd.nix \
|
! -path ./modules/services/mpd.nix \
|
||||||
|
|
|
@ -56,7 +56,8 @@ let
|
||||||
set -g status-keys ${cfg.keyMode}
|
set -g status-keys ${cfg.keyMode}
|
||||||
set -g mode-keys ${cfg.keyMode}
|
set -g mode-keys ${cfg.keyMode}
|
||||||
|
|
||||||
${optionalString (cfg.keyMode == "vi" && cfg.customPaneNavigationAndResize) ''
|
${optionalString
|
||||||
|
(cfg.keyMode == "vi" && cfg.customPaneNavigationAndResize) ''
|
||||||
bind h select-pane -L
|
bind h select-pane -L
|
||||||
bind j select-pane -D
|
bind j select-pane -D
|
||||||
bind k select-pane -U
|
bind k select-pane -U
|
||||||
|
@ -68,21 +69,19 @@ let
|
||||||
bind -r L resize-pane -R ${toString cfg.resizeAmount}
|
bind -r L resize-pane -R ${toString cfg.resizeAmount}
|
||||||
''}
|
''}
|
||||||
|
|
||||||
${if cfg.prefix != null
|
${if cfg.prefix != null then ''
|
||||||
then ''
|
|
||||||
# rebind main key: ${cfg.prefix}
|
# rebind main key: ${cfg.prefix}
|
||||||
unbind C-${defaultShortcut}
|
unbind C-${defaultShortcut}
|
||||||
set -g prefix ${cfg.prefix}
|
set -g prefix ${cfg.prefix}
|
||||||
bind ${cfg.prefix} send-prefix
|
bind ${cfg.prefix} send-prefix
|
||||||
''
|
'' else
|
||||||
else optionalString (cfg.shortcut != defaultShortcut) ''
|
optionalString (cfg.shortcut != defaultShortcut) ''
|
||||||
# rebind main key: C-${cfg.shortcut}
|
# rebind main key: C-${cfg.shortcut}
|
||||||
unbind C-${defaultShortcut}
|
unbind C-${defaultShortcut}
|
||||||
set -g prefix C-${cfg.shortcut}
|
set -g prefix C-${cfg.shortcut}
|
||||||
bind ${cfg.shortcut} send-prefix
|
bind ${cfg.shortcut} send-prefix
|
||||||
bind C-${cfg.shortcut} last-window
|
bind C-${cfg.shortcut} last-window
|
||||||
''
|
''}
|
||||||
}
|
|
||||||
|
|
||||||
${optionalString cfg.disableConfirmationPrompt ''
|
${optionalString cfg.disableConfirmationPrompt ''
|
||||||
bind-key & kill-window
|
bind-key & kill-window
|
||||||
|
@ -96,18 +95,16 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configPlugins = {
|
configPlugins = {
|
||||||
assertions = [(
|
assertions = [
|
||||||
let
|
(let
|
||||||
hasBadPluginName = p: !(hasPrefix "tmuxplugin" (pluginName p));
|
hasBadPluginName = p: !(hasPrefix "tmuxplugin" (pluginName p));
|
||||||
badPlugins = filter hasBadPluginName cfg.plugins;
|
badPlugins = filter hasBadPluginName cfg.plugins;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
assertion = badPlugins == [ ];
|
assertion = badPlugins == [ ];
|
||||||
message =
|
message = ''Invalid tmux plugin (not prefixed with "tmuxplugins"): ''
|
||||||
"Invalid tmux plugin (not prefixed with \"tmuxplugins\"): "
|
|
||||||
+ concatMapStringsSep ", " pluginName badPlugins;
|
+ concatMapStringsSep ", " pluginName badPlugins;
|
||||||
}
|
})
|
||||||
)];
|
];
|
||||||
|
|
||||||
xdg.configFile."tmux/tmux.conf".text = ''
|
xdg.configFile."tmux/tmux.conf".text = ''
|
||||||
# ============================================= #
|
# ============================================= #
|
||||||
|
@ -118,18 +115,13 @@ let
|
||||||
# ${pluginName p}
|
# ${pluginName p}
|
||||||
# ---------------------
|
# ---------------------
|
||||||
${p.extraConfig or ""}
|
${p.extraConfig or ""}
|
||||||
run-shell ${
|
run-shell ${if types.package.check p then p.rtp else p.plugin.rtp}
|
||||||
if types.package.check p
|
|
||||||
then p.rtp
|
|
||||||
else p.plugin.rtp
|
|
||||||
}
|
|
||||||
'') cfg.plugins)}
|
'') cfg.plugins)}
|
||||||
# ============================================= #
|
# ============================================= #
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in
|
|
||||||
|
|
||||||
{
|
in {
|
||||||
options = {
|
options = {
|
||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
aggressiveResize = mkOption {
|
aggressiveResize = mkOption {
|
||||||
|
@ -294,8 +286,9 @@ in
|
||||||
|
|
||||||
plugins = mkOption {
|
plugins = mkOption {
|
||||||
type = with types;
|
type = with types;
|
||||||
listOf (either package pluginModule)
|
listOf (either package pluginModule) // {
|
||||||
// { description = "list of plugin packages or submodules"; };
|
description = "list of plugin packages or submodules";
|
||||||
|
};
|
||||||
description = ''
|
description = ''
|
||||||
List of tmux plugins to be included at the end of your tmux
|
List of tmux plugins to be included at the end of your tmux
|
||||||
configuration. The sensible plugin, however, is defaulted to
|
configuration. The sensible plugin, however, is defaulted to
|
||||||
|
@ -322,22 +315,22 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable (
|
config = mkIf cfg.enable (mkMerge ([
|
||||||
mkMerge ([
|
|
||||||
{
|
{
|
||||||
home.packages = [ cfg.package ]
|
home.packages = [ cfg.package ]
|
||||||
++ optional cfg.tmuxinator.enable pkgs.tmuxinator
|
++ optional cfg.tmuxinator.enable pkgs.tmuxinator
|
||||||
++ optional cfg.tmuxp.enable pkgs.tmuxp;
|
++ optional cfg.tmuxp.enable pkgs.tmuxp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ xdg.configFile."tmux/tmux.conf".text = mkBefore tmuxConf; }
|
||||||
|
{ xdg.configFile."tmux/tmux.conf".text = mkAfter cfg.extraConfig; }
|
||||||
|
|
||||||
(mkIf cfg.secureSocket {
|
(mkIf cfg.secureSocket {
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
TMUX_TMPDIR = ''''${XDG_RUNTIME_DIR:-"/run/user/\$(id -u)"}'';
|
TMUX_TMPDIR = ''''${XDG_RUNTIME_DIR:-"/run/user/\$(id -u)"}'';
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
{ xdg.configFile."tmux/tmux.conf".text = mkBefore tmuxConf; }
|
|
||||||
(mkIf (cfg.plugins != [ ]) configPlugins)
|
(mkIf (cfg.plugins != [ ]) configPlugins)
|
||||||
{ xdg.configFile."tmux/tmux.conf".text = mkAfter cfg.extraConfig; }
|
]));
|
||||||
])
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue