Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draft: tmux: add configBeforePlugin option #3801

Closed
wants to merge 6 commits into from

Conversation

Pegasust
Copy link

@Pegasust Pegasust commented Mar 24, 2023

Description

Checklist

@Pegasust Pegasust requested a review from rycee as a code owner March 24, 2023 17:13
@rycee
Copy link
Member

rycee commented Mar 24, 2023

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 <[email protected]>
@Pegasust
Copy link
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
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
Author

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

@stale
Copy link

stale bot commented Jun 23, 2023

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
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.

@Pegasust Pegasust closed this Aug 24, 2023
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