1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-05 16:27:03 +00:00

move tmux.conf to programs.tmux module

This commit is contained in:
Daiderd Jordan 2016-11-06 23:38:42 +01:00
parent 926395d628
commit c137718ff7
No known key found for this signature in database
GPG key ID: D02435D05B810C96
3 changed files with 29 additions and 24 deletions

View file

@ -49,6 +49,13 @@ let
programs.tmux.enableMouse = true; programs.tmux.enableMouse = true;
programs.tmux.enableVim = true; programs.tmux.enableVim = true;
programs.tmux.tmuxConfig = ''
bind 0 set status
set -g status-bg black
set -g status-fg white
'';
environment.variables.EDITOR = "vim"; environment.variables.EDITOR = "vim";
environment.variables.HOMEBREW_CASK_OPTS = "--appdir=/Applications/cask"; environment.variables.HOMEBREW_CASK_OPTS = "--appdir=/Applications/cask";
@ -60,16 +67,6 @@ let
environment.shellAliases.g = "git log --graph --oneline"; environment.shellAliases.g = "git log --graph --oneline";
environment.shellAliases.gd = "git diff --minimal -p"; environment.shellAliases.gd = "git diff --minimal -p";
environment.etc."tmux.conf".text = ''
${config.programs.tmux.config}
bind 0 set status
set -g status-bg black
set -g status-fg white
source-file $HOME/.tmux.conf.local
'';
environment.etc."zprofile".text = '' environment.etc."zprofile".text = ''
# /etc/zprofile: DO NOT EDIT -- this file has been generated automatically. # /etc/zprofile: DO NOT EDIT -- this file has been generated automatically.
# This file is read for login shells. # This file is read for login shells.

Binary file not shown.

View file

@ -8,8 +8,12 @@ let
cfg = config.programs.tmux; cfg = config.programs.tmux;
tmuxConfigs = text = import ../system/write-text.nix {
mapAttrsToList (n: v: "${v}") cfg.text; inherit lib;
mkTextDerivation = name: text: pkgs.writeText "tmux-options-${name}" text;
};
tmuxOptions = concatMapStringsSep "\n" (attr: attr.text) (attrValues cfg.tmuxOptions);
in { in {
options = { options = {
@ -49,16 +53,14 @@ in {
''; '';
}; };
programs.tmux.config = mkOption { programs.tmux.tmuxConfig = mkOption {
type = types.lines; type = types.lines;
description = '' default = "";
Configuration options.
'';
}; };
programs.tmux.text = mkOption { programs.tmux.tmuxOptions = mkOption {
internal = true; internal = true;
type = types.attrsOf types.lines; type = types.attrsOf (types.submodule text);
default = {}; default = {};
}; };
@ -66,15 +68,13 @@ in {
config = { config = {
programs.tmux.config = concatStringsSep "\n" tmuxConfigs; programs.tmux.tmuxOptions.login-shell.text = if stdenv.isDarwin then ''
programs.tmux.text.login-shell = if stdenv.isDarwin then ''
set -g default-command "reattach-to-user-namespace ${cfg.loginShell}" set -g default-command "reattach-to-user-namespace ${cfg.loginShell}"
'' else '' '' else ''
set -g default-command "${cfg.loginShell}" set -g default-command "${cfg.loginShell}"
''; '';
programs.tmux.text.sensible = mkIf cfg.enableSensible ('' programs.tmux.tmuxOptions.sensible.text = mkIf cfg.enableSensible (''
set -g default-terminal "screen-256color" set -g default-terminal "screen-256color"
setw -g aggressive-resize on setw -g aggressive-resize on
@ -96,13 +96,13 @@ in {
# set -g utf8 on # set -g utf8 on
''); '');
programs.tmux.text.mouse = mkIf cfg.enableMouse '' programs.tmux.tmuxOptions.mouse.text = mkIf cfg.enableMouse ''
set -g mouse on set -g mouse on
setw -g mouse on setw -g mouse on
set -g terminal-overrides 'xterm*:smcup@:rmcup@' set -g terminal-overrides 'xterm*:smcup@:rmcup@'
''; '';
programs.tmux.text.vim = mkIf cfg.enableVim ('' programs.tmux.tmuxOptions.vim.text = mkIf cfg.enableVim (''
setw -g mode-keys vi setw -g mode-keys vi
bind h select-pane -L bind h select-pane -L
@ -119,5 +119,13 @@ in {
bind -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" bind -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
''); '');
environment.etc."tmux.conf".text = ''
${tmuxOptions}
${cfg.tmuxConfig}
source-file -q /etc/tmux.conf.local
'';
}; };
} }