How to configure tmuxPlugins.tmux-powerline

I’m looking to configure tmux-powerline as installed by tmuxPlugins.tmux-powerline. I suspect it’s reading the config from the nix store, but I don’t know. I also don’t know how stylix is interacting with the tmuxPlugin.tmux-powerline config, but it’s changing the colors.

Edit for more details: I’m using NixOS and home-manager and flakes.

This his led me to pursue a deeper understanding of the nix language, and how I might be able to answer these questions by reading the source code.
My specific questions are:

  1. How would you determine where the tmux-powerline config is being read from?
  2. How would you change where it’s read from so you can edit it, if it’s in the nix store?
  3. What is your preferred method of reading the nix source code when seeking answers about how it’s working?

Thank you so much. <3

POST ASSUMES A SETUP WITH a builtins.nixPath that works.

❯ nix repl --file '<nixpkgs>'
Nix 2.28.4
Type :? for help.
Loading installable ''...
Added 24807 variables.
nix-repl> builtins.unsafeGetAttrPos "tmux-powerline" tmuxPlugins
{
  column = 3;
  file = "/nix/store/jg7mv708wsf2vk6afgi5lpj4w2dppflw-source/pkgs/misc/tmux-plugins/default.nix";
  line = 851;
}

alternatively, assuming you have a nixpkgs in a nice place.

❯ rg 'tmux-powerline =' /etc/nixos/nixpkgs/
/etc/nixos/nixpkgs/pkgs/misc/tmux-plugins/default.nix
851:  tmux-powerline = mkTmuxPlugin {

Of course, you can always find a nix source with

~                                                                                     16:50:41
❯ nix repl --file '<nixpkgs>'
Nix 2.28.4
Type :? for help.
Loading installable ''...
Added 24807 variables.
nix-repl> <nixpkgs>
/nix/store/jg7mv708wsf2vk6afgi5lpj4w2dppflw-source

For editing, I’d probably have a nixpkgs checkout just because it’s easiest then any changes can be turned in a patch with git format-patch, and then pkgs.applyPatches can be applied to any source, including nixpkgs itself. You can see an example in this blog post.

If I want to read something I just open my local sources in my editor (in this case, emacs, but anything will do as long as it’s local).

1 Like

thank you so much for this detailed response! I love how quickly a repl can help me understand a language, so this is really exciting for me.

Also! I love your blog. And I saw that you wrote a forScore alternative. forScore has been the main thing keeping me in the apple ecosystem for however many years that forScore has been the industry standard. I love that you made a solution for that. <3 <3 I’m actually moving from a 20 year long career in music to a career in tech, so maybe I’ll finally get to move to a non-forScore solution, at least for my recreational music making! if I never use an ipad again, it’ll be too soon.

1 Like

It’s not my blog, that’s @piegames blog, but it has some gems in it :slight_smile:

2 Likes

oh duh. my reading comprehension has been suffering as I ween off coffee :laughing:

The repl is super great and I think very underrated for nix. :doc has pretty great coverage, :b / :p are great, and a lovely thing is how sources are derivations so you can immediately see the source of anything with :b foo.src i.e.

/nix/store/xmd22xp4nxpvrhsqnxn38v8kq5cncbid-source                                  17:00:42
❯ nix repl --file '<nixpkgs>'
Nix 2.28.4
Type :? for help.
Loading installable ''...
Added 24807 variables.
nix-repl> :b tmuxPlugins.tmux-powerline.src

This derivation produced the following outputs:
  out -> /nix/store/fj80pxjhiff7lvnnzz29akd54y5jyc5k-source



/nix/store/xmd22xp4nxpvrhsqnxn38v8kq5cncbid-source                              17s 17:15:06
❯ lt /nix/store/fj80pxjhiff7lvnnzz29akd54y5jyc5k-source
/nix/store/fj80pxjhiff7lvnnzz29akd54y5jyc5k-source
├── AUTHORS
├── CHANGELOG.md
├── color_palette.sh
├── config
│   ├── defaults.sh
│   ├── helpers.sh
│   ├── paths.sh
│   └── shell.sh
├── generate_rc.sh
├── img
...
1 Like

this is amazing!! is lt an alias for tree?

  1. I found the powerline config through a mix of their docs and the command nix-store -q --graph /run/current-system | grep 'powerline'
  2. I then copied the contents of that directory to where it would usually be installed, and changed my tmux config from installing tmux-powerline with nixos to just using the aforementioned copied folder. I added run-shell ~/.config/tmux/plugins/tmux-powerline/main.tmux to tmux.conf with extraConfig

I look forward to a more elegant solution, but I gotta get back to work lol. Too much config futzing on a Tuesday morning already. But as far as a nicer solution is concerned, I reckon I could either:

  • find the preexisting solution provided by Nix/OS
  • make a solution with nix
    …is there a preexisting solution with nix? <3

lt is an alias for eza --tree. You can find the module I am using here here.