Skip to content

draft: tmux: add configBeforePlugin option - #3801

Closed
Pegasust wants to merge 6 commits into
nix-community:masterfrom
Pegasust:master
Closed

Pegasust wants to merge 6 commits into
nix-community:masterfrom
Pegasust:master

Conversation

@Pegasust

@Pegasust Pegasust commented Mar 24, 2023 •

Copy link
Copy Markdown

Description

Checklist

@Pegasust
Pegasust requested a review from rycee as a code owner March 24, 2023 17:13
Comment thread modules/programs/tmux.nix Outdated
Comment thread modules/programs/tmux.nix Outdated
@rycee

rycee commented Mar 24, 2023

Copy link
Copy Markdown
Member

Thanks for the contribution!

An alternative is to do something like

xdg.configFile."tmux/tmux.conf".text = lib.mkOrder 600 "…";

in your configuration.

Co-authored-by: Robert Helgesson <robert@rycee.net>
@Pegasust

Copy link
Copy Markdown
Author
xdg.configFile."tmux/tmux.conf".text = lib.mkOrder 600 "…";

I'm not too familiar with lib.mkBefore and lib.mkAfter. I know lib.mkOrder is something between providing the actual value and lib.mkDefault.

Does lib.mkOrder override any of the fields or does it correctly place the section between the end of lib.mkBefore tmuxConfig and the beginning of lib.mkAfter cfg.extraConfig?

@ncfavier

Copy link
Copy Markdown
Member

There are two different things here: mkDefault and mkForce are defined in terms of mkOverride and determine the override priority of definitions. mkBefore and mkAfter are defined in terms of mkOrder and determine the order priority of definitions.

Only the definitions with the highest override priority are used, and, if there are several, they are ordered according to their order priority.

Here all the definitions have the same override priority, so let's focus on order priorities. The definitions in the module are as follows:

  • mkBefore tmuxConf (priority = 500)
  • pluginsConf (default priority = 1000)
  • mkAfter cfg.extraConfig (priority = 1500)

So, if you add a definition with mkOrder 600 (or any number between 500 and 1000), it will get ordered between the general tmux config and the plugins config.

@Pegasust

Copy link
Copy Markdown
Author

Makes so much sense now! I was confused between order priority vs override priority. Thanks for the clarification!

@stale

stale Bot commented Jun 23, 2023

Copy link
Copy Markdown

Thank you for your contribution! I marked this pull request as stale due to inactivity. Please read the relevant sections below before commenting.

If you are the original author of the PR

  • GitHub sometimes doesn't notify people who commented / reviewed a PR previously when you (force) push commits. If you have addressed the reviews you can officially ask for a review from those who commented to you or anyone else.
  • If it is unfinished but you plan to finish it, please mark it as a draft.
  • If you don't expect to work on it any time soon, please consider closing it with a short comment encouraging someone else to pick up your work.
  • To get things rolling again, rebase the PR against the target branch and address valid comments.

If you are not the original author of the PR

  • If you want to pick up the work on this PR, please create a new PR and indicate that it supercedes and closes this PR.

@stale stale Bot added the status: stale label Jun 23, 2023
@Pegasust

Copy link
Copy Markdown
Author

Just to clean up home-manager's PR queue, I eventually took @rycee 's recommendation and implemented something similar. Thanks all for helping me out on this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants