summary refs log tree commit diff
path: root/nixos/modules/programs/tmux.nix
diff options
context:
space:
mode:
authorJeremy Kolb <kjeremy@gmail.com>2021-09-18 11:04:11 -0400
committerJeremy Kolb <jkolb@ara.com>2022-01-25 17:12:44 -0500
commit7be304a5439303deb7f52eceee1b31bb08610a16 (patch)
tree2bee4643a645e93769f79d3a93db9304131dc6f4 /nixos/modules/programs/tmux.nix
parent0773ddbeba8abed32c2ff8025fa71b24f5f1225a (diff)
downloadnixpkgs-7be304a5439303deb7f52eceee1b31bb08610a16.tar
nixpkgs-7be304a5439303deb7f52eceee1b31bb08610a16.tar.gz
nixpkgs-7be304a5439303deb7f52eceee1b31bb08610a16.tar.bz2
nixpkgs-7be304a5439303deb7f52eceee1b31bb08610a16.tar.lz
nixpkgs-7be304a5439303deb7f52eceee1b31bb08610a16.tar.xz
nixpkgs-7be304a5439303deb7f52eceee1b31bb08610a16.tar.zst
nixpkgs-7be304a5439303deb7f52eceee1b31bb08610a16.zip
nixos/programs/tmux: specify wanted plugins
Currently it's rather difficult to install tmux plugins. The process involves two steps:
  1. Specify the correct `pkg.tmuxPlugins` package in `environment.systemPackages`
  2. Adding to the configuration file to instantiate the plugin.

This commit allows the user to specify a list of plugins under `programs.tmux.plugins`.

Update nixos/modules/programs/tmux.nix

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'nixos/modules/programs/tmux.nix')
-rw-r--r--nixos/modules/programs/tmux.nix15
1 files changed, 14 insertions, 1 deletions
diff --git a/nixos/modules/programs/tmux.nix b/nixos/modules/programs/tmux.nix
index c39908751d2..74b3fbd9ac0 100644
--- a/nixos/modules/programs/tmux.nix
+++ b/nixos/modules/programs/tmux.nix
@@ -52,6 +52,12 @@ let
     set  -s escape-time       ${toString cfg.escapeTime}
     set  -g history-limit     ${toString cfg.historyLimit}
 
+    ${lib.optionalString (cfg.plugins != []) ''
+    # Run plugins
+    ${lib.concatMapStringsSep "\n" (x: "run-shell ${x.rtp}") cfg.plugins}
+
+    ''}
+
     ${cfg.extraConfig}
   '';
 
@@ -165,6 +171,13 @@ in {
           downside it doesn't survive user logout.
         '';
       };
+
+      plugins = mkOption {
+        default = [];
+        type = types.listOf types.package;
+        description = "List of plugins to install.";
+        example = lib.literalExpression "[ pkgs.tmuxPlugins.nord ]";
+      };
     };
   };
 
@@ -174,7 +187,7 @@ in {
     environment = {
       etc."tmux.conf".text = tmuxConf;
 
-      systemPackages = [ pkgs.tmux ];
+      systemPackages = [ pkgs.tmux ] ++ cfg.plugins;
 
       variables = {
         TMUX_TMPDIR = lib.optional cfg.secureSocket ''''${XDG_RUNTIME_DIR:-"/run/user/$(id -u)"}'';