summaryrefslogtreecommitdiff
path: root/modules/programs
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2016-11-06 23:38:42 +0100
committerDaiderd Jordan <daiderd@gmail.com>2016-11-06 23:38:42 +0100
commitc137718ff7ead30c2424a87dc9d47c2193f4b83b (patch)
tree171427a9cf1e329b862a3c2c2339f385bda3ad14 /modules/programs
parent926395d628aa4cf9c96f234e5039a2d117d8f67a (diff)
move tmux.conf to programs.tmux module
Diffstat (limited to 'modules/programs')
-rw-r--r--modules/programs/.tmux.nix.swpbin0 -> 12288 bytes
-rw-r--r--modules/programs/tmux.nix36
2 files changed, 22 insertions, 14 deletions
diff --git a/modules/programs/.tmux.nix.swp b/modules/programs/.tmux.nix.swp
new file mode 100644
index 0000000..12b196f
--- /dev/null
+++ b/modules/programs/.tmux.nix.swp
Binary files differ
diff --git a/modules/programs/tmux.nix b/modules/programs/tmux.nix
index 18967d2..ea17d3d 100644
--- a/modules/programs/tmux.nix
+++ b/modules/programs/tmux.nix
@@ -8,8 +8,12 @@ let
cfg = config.programs.tmux;
- tmuxConfigs =
- mapAttrsToList (n: v: "${v}") cfg.text;
+ text = import ../system/write-text.nix {
+ inherit lib;
+ mkTextDerivation = name: text: pkgs.writeText "tmux-options-${name}" text;
+ };
+
+ tmuxOptions = concatMapStringsSep "\n" (attr: attr.text) (attrValues cfg.tmuxOptions);
in {
options = {
@@ -49,16 +53,14 @@ in {
'';
};
- programs.tmux.config = mkOption {
+ programs.tmux.tmuxConfig = mkOption {
type = types.lines;
- description = ''
- Configuration options.
- '';
+ default = "";
};
- programs.tmux.text = mkOption {
+ programs.tmux.tmuxOptions = mkOption {
internal = true;
- type = types.attrsOf types.lines;
+ type = types.attrsOf (types.submodule text);
default = {};
};
@@ -66,15 +68,13 @@ in {
config = {
- programs.tmux.config = concatStringsSep "\n" tmuxConfigs;
-
- programs.tmux.text.login-shell = if stdenv.isDarwin then ''
+ programs.tmux.tmuxOptions.login-shell.text = if stdenv.isDarwin then ''
set -g default-command "reattach-to-user-namespace ${cfg.loginShell}"
'' else ''
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"
setw -g aggressive-resize on
@@ -96,13 +96,13 @@ in {
# set -g utf8 on
'');
- programs.tmux.text.mouse = mkIf cfg.enableMouse ''
+ programs.tmux.tmuxOptions.mouse.text = mkIf cfg.enableMouse ''
set -g mouse on
setw -g mouse on
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
bind h select-pane -L
@@ -119,5 +119,13 @@ in {
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
+ '';
+
};
}