2.home-manager/modules/programs/tmuxinator.nix
Benedikt Ritter 9cc761169a tmuxinator: use yml file ending
Files with yaml file ending are recognized by `tmuxinator start` but not
by `tmuxinator list`.

Resolves #9031
2026-04-07 13:40:48 -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}.yml" {
source = yamlFormat.generate "${k}.yml" v;
}
) cfg.tmuxinator.projects;
};
}