LnL7 / nix-darwin

nix modules for darwin
MIT License
3.26k stars 463 forks source link

`programs.tmux` options error on a `darwin-rebuild` #1214

Open taylrfnt opened 8 hours ago

taylrfnt commented 8 hours ago

I am attempting to migrate my tmux configs from a NixOS system to my MacOS workstation, and I am encountering errors when running a darwin-rebuild that seem to indicate that nix-darwin is unable to properly interpret/locate the tmux options:

❯ darwin-rebuild switch --flake ~/dotfiles/nix/darwin#amaterasu
building the system configuration...
warning: Git tree '/Users/taylorfont/dotfiles' is dirty
error:
       … while evaluating the attribute 'config.system.build.toplevel'
         at /nix/store/d8db0cwn7dsnr7vd4xzj3jlw0s6sja8x-source/lib/modules.nix:334:9:
          333|         options = checked options;
          334|         config = checked (removeAttrs config [ "_module" ]);
             |         ^
          335|         _module = checked (config._module);

       … while calling the 'seq' builtin
         at /nix/store/d8db0cwn7dsnr7vd4xzj3jlw0s6sja8x-source/lib/modules.nix:334:18:
          333|         options = checked options;
          334|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          335|         _module = checked (config._module);

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: The option `programs.tmux.baseIndex' does not exist. Definition values:
       - In `<unknown-file>': 1

The baseIndex option is a tmux parameter in the standard nix program configs.

I can create a separate tmux.conf file if need be as a temporary fix, but I am hoping this is error on my use of nix-darwin. Let me know if more logs or snippets from my config are needed to triage.

Enzime commented 8 hours ago

We don't have an option for programs.tmux.baseIndex, you can add tmux configuration using the following option:

https://daiderd.com/nix-darwin/manual/index.html#opt-programs.tmux.tmuxOptions._name_.text

{
  programs.tmux.tmuxOptions.my-tmux-config.text = ''
    set -g base-index 1
  '';
}
taylrfnt commented 8 hours ago

Ah, I did not realize nix-darwin did not use all of the vanilla tmux configs. I'll poke around and see what I can get working. Many thanks!

taylrfnt commented 7 hours ago

After a few tweaks... for my purposes, programs.tmux.extraConfig was sufficient. Thanks @Enzime !!! Since I am new to nix-darwin I will ask another question which may be answered elsewhere as well...

My NixOS-based flake has some extra bells and whistles for tmux plugins (namely, being able to select & configure them directly like this):

programs.tmux = {
  [...];
  plugins = with pkgs; [
    tmuxPlugins.cpu
    {
      plugin = tmuxPlugins.catppuccin;
      extraConfig = ''
        set -g @catppuccin_flavor mocha
      '';
    } 
  ];
};

I couldn't get that to work via the tmuxOptions.text option - is that something that just wouldn't be possible with nix-darwin, or more user error on my end?

(FWIW, I have those plugins imported and working via the extraConfig option - I'm just trying to retain as much parity with my NixOS flake configs as possible 😄 )