git.iko.soy/typeable/nixpkgs
on master help sign in
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>

commit7be304a5439303deb7f52eceee1b31bb08610a16 authorJeremy Kolb <kjeremy@gmail.com> dateSat 18 Sep 2021, 11:04 (5 years ago) parent0773ddb
3 files changed+25−1
nixos/doc/manual/from_md/release-notes/rl-2205.section.xml+9 nixos/doc/manual/release-notes/rl-2205.section.md+2 nixos/modules/programs/tmux.nix+14−1
nixos/doc/manual/from_md/release-notes/rl-2205.section.xml+9
@@ -712,6 +712,15 @@
712712 warning.
713713 </para>
714714 </listitem>
715+ <listitem>
716+ <para>
717+ <literal>programs.tmux</literal> has a new option
718+ <literal>plugins</literal> that accepts a list of packages
719+ from the <literal>tmuxPlugins</literal> group. The specified
720+ packages are added to the system and loaded by
721+ <literal>tmux</literal>.
722+ </para>
723+ </listitem>
715724 </itemizedlist>
716725 </section>
717726</section>
nixos/doc/manual/release-notes/rl-2205.section.md+2
@@ -243,4 +243,6 @@ In addition to numerous new and upgraded packages, this release has the followin
243243 Reason is that the old name has been deprecated upstream.
244244 Using the old option name will still work, but produce a warning.
245245
246+- `programs.tmux` has a new option `plugins` that accepts a list of packages from the `tmuxPlugins` group. The specified packages are added to the system and loaded by `tmux`.
247+
246248<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
nixos/modules/programs/tmux.nix+14−1
@@ -52,6 +52,12 @@ let
5252 set -s escape-time ${toString cfg.escapeTime}
5353 set -g history-limit ${toString cfg.historyLimit}
5454
55+ ${lib.optionalString (cfg.plugins != []) ''
56+ # Run plugins
57+ ${lib.concatMapStringsSep "\n" (x: "run-shell ${x.rtp}") cfg.plugins}
58+
59+ ''}
60+
5561 ${cfg.extraConfig}
5662 '';
5763
@@ -165,6 +171,13 @@ in {
165171 downside it doesn't survive user logout.
166172 '';
167173 };
174+
175+ plugins = mkOption {
176+ default = [];
177+ type = types.listOf types.package;
178+ description = "List of plugins to install.";
179+ example = lib.literalExpression "[ pkgs.tmuxPlugins.nord ]";
180+ };
168181 };
169182 };
170183
@@ -174,7 +187,7 @@ in {
174187 environment = {
175188 etc."tmux.conf".text = tmuxConf;
176189
177− systemPackages = [ pkgs.tmux ];
190+ systemPackages = [ pkgs.tmux ] ++ cfg.plugins;
178191
179192 variables = {
180193 TMUX_TMPDIR = lib.optional cfg.secureSocket ''''${XDG_RUNTIME_DIR:-"/run/user/$(id -u)"}'';