Skip to content

zellij: nix to kdl parser broken when trying to use programs.zellij.settings #444111

Description

@jamesla

Nixpkgs version

  • Unstable (25.11)

Describe the bug

I am trying to write a zellij config using the programs.zellij.settings object which takes a nix config and then converts it to the zellij config syntax automatically.

I am trying to essentially create the following config but in nix

keybinds {
    normal {
        bind "Ctrl H" { MoveFocus "Left"; }
        bind "Ctrl L" { MoveFocus "Right"; }
    }
}

I have attempted the following, which works:

keybinds = {
  normal = {
    bind = { _args = ["Ctrl h"]; MoveFocus = ["Left"]; };
  };
};

However as soon as I add my second binding it breaks as nix object appear to want unique keys (duplicate bind key):

keybinds = {
  normal = {
    bind = { _args = ["Ctrl h"]; MoveFocus = ["Left"]; };
    bind = { _args = ["Ctrl l"]; MoveFocus = ["Right"]; };
  };
};

and throws the error error: attribute 'bind._args' already defined

The docs (here)[https://mynixos.com/home-manager/option/programs.zellij.settings]has a getting started example that also appears to be broken there example config doesn't parse into a valid zellij config either.

As you can see it's not following the _children property convention and actually rendering it and it's also adding - My best guess is that the nix to kdl parser is broken.

keybinds {
        pane {
                _children {
                        - {
                                bind "e" {
                                        _children {
                                                - {
                                                        TogglePaneEmbedOrFloating {

                                                        }
                                                }
                                                - {
                                                        SwitchToMode "locked" {

                                                        }
                                                }
                                        }
                                }
                        }
                        - {
                                bind "left" {
                                        MoveFocus "left"
                                }
                        }
                }
        }
}

Does anybody know how I can achieve my desired config output via a valid nix object?

Steps to reproduce

programs.zellij = {
  enable = true;
  settings = {
    keybinds = {
    normal = {
      bind = { _args = ["Ctrl h"]; MoveFocus = ["Left"]; };
      bind = { _args = ["Ctrl l"]; MoveFocus = ["Right"]; };
    };
  }; 
};

Expected behaviour

it should render a valid zellij config

Screenshots

No response

Relevant log output

Additional context

No response

System metadata

  • system: "aarch64-linux"
  • host os: Linux 6.6.87, NixOS, 24.11 (Vicuna), 24.11.20250421.9684b53
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.24.14
  • nixpkgs: /nix/store/52hnnvpyni1n79ra4rqxdcswmd2w3823-source

Notify maintainers


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions