Suddenly setting caps:escape in xkb settings does not work anymore

I have been remapping caps lock to escape since starting nixos, and it has always worked.

Now I updated nixpkgs and suddenly caps lock is caps lock. I found nothing in here nor in the nixpkgs issues.

Current nixpkgs rev: b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef
Updated nixpkgs rev: adaa24fbf46737f3f1b5497bf64bae750f82942e

This is the configuration I have been using:

services.xserver.xkb = {
  layout = "us";
  model = "pc104";
  options = "caps:escape";
  variant = "altgr-intl";
};

I have always been on GNOME.

I am also experiencing this issue.

EDIT: I seem to have this issue only in vscode, adding

    "keyboard.dispatch": "keyCode"

To the vscode settings seems to have resolved the issue.

I think your issue is unrelated.

I’d recommend using keyd for that

here’s how I remap caps to ctrl:

  services.keyd = {
    enable = true;
    keyboards = {
      default = {
        ids = [ "*" ];
        settings = {
          main = {
            capslock = "layer(control)";
            rightcontrol = "rightcontrol";
          };
          otherlayer = { };
        };
      };
    };
  };

Looks nice, too.

I switched to udevmon temporarily:

{ pkgs, lib, ... }: {
  services.interception-tools =
    let
      inherit (pkgs.interception-tools-plugins) caps2esc;
      inherit (pkgs) interception-tools;
    in
    {
      enable = true;
      plugins = [ caps2esc ];
      udevmonConfig = lib.strings.toJSON [{
        JOB = builtins.concatStringsSep " | " [
          "${interception-tools}/bin/intercept -g $DEVNODE"
          "${lib.getExe caps2esc} -m 1 -t 0" 
          "${interception-tools}/bin/uinput -d $DEVNODE"
        ];
        DEVICE.EVENTS.EV_KEY = [ "KEY_CAPSLOCK" "KEY_ESC" ];
      }];
    };
}