2.home-manager/modules/programs/tmuxinator.nix
Benedikt Ritter b399348e9d tmuxinator: move to dedicated module with projects support
Extract tmuxinator from tmux.nix into its own programs/tmuxinator.nix
module. The new module adds:

- programs.tmux.tmuxinator.package for customising the tmuxinator package
- programs.tmux.tmuxinator.projects for declaring projects declaratively;
  each project is written to $HOME/.config/tmuxinator/<name>.yaml

Co-authored-by: Austin Horstman <khaneliman12@gmail.com>
2026-03-31 14:05:50 -05:00

61 lines
1.6 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.tmux;
yamlFormat = pkgs.formats.yaml { };
in
{
meta.maintainers = [ lib.maintainers.britter ];
options.programs.tmux.tmuxinator = {
enable = lib.mkEnableOption "tmuxinator";
package = lib.mkPackageOption pkgs "tmuxinator" { nullable = true; };
projects = lib.mkOption {
type = lib.types.attrsOf yamlFormat.type;
default = { };
description = ''
Tmuxinator projects to write to {file}`$HOME/.config/tmuxinator`.
One project configuration file is generated per attribute.
See <https://github.com/tmuxinator/tmuxinator> for the project
configuration format.
'';
example = lib.literalExpression ''
{
myproject = {
root = "~/code/myproject";
windows = [
{
editor = {
layout = "main-vertical";
panes = [
{ editor = [ "vim" ]; }
"guard"
];
};
}
{ server = "bundle exec rails s"; }
{ logs = "tail -f log/development.log"; }
];
};
}
'';
};
};
config = lib.mkIf (cfg.enable && cfg.tmuxinator.enable) {
home.packages = lib.mkIf (cfg.tmuxinator.package != null) [ cfg.tmuxinator.package ];
xdg.configFile = lib.mapAttrs' (
k: v:
lib.nameValuePair "tmuxinator/${k}.yaml" {
source = yamlFormat.generate "${k}.yaml" v;
}
) cfg.tmuxinator.projects;
};
}