How to start i3 using greetd

Hello, I’ve been switching my NixOS configuration to a flake config + standalone home-manager and I’ve been trying to set up greetd for a login manager without success, here is my current configuration:


{ config, lib, pkgs, ... }: {
  # Force kernel log in tty1, otherwise it will override greetd
  boot.kernelParams = [ "console=tty1" ];

  services.xserver = {
    enable = true;
    tty = 7;
    videoDrivers = [ "nvidia" ];
    displayManager.sx.enable = true; # lightweight startx alternative

    # Disable Caps Lock key and use it as CTRL
    xkbOptions = "ctrl:nocaps";

    # Disable xterm package
    excludePackages = [ pkgs.xterm ];
  };

  programs.dconf.enable = true;

  services.greetd = {
    enable = true;
    vt = config.services.xserver.tty;
    restart = false; # should be disabled when using autologin
    settings = {
      default_session = {
        command = lib.concatStringsSep " " [
          "${pkgs.greetd.tuigreet}/bin/tuigreet"
          "--remember"
          "--asterisks"
          "--time"
          "--cmd sx"
        ];
        user = "greeter";
      };
    };
  };
}

Home-manager is managing my xsession and generating the .config/sx/sxrc file.

The problem is that when I login, it shows the wallpaper and apparently loads the graphical environment, but none of my i3 keybindings works, and polybar (which is the only program started by i3) does not show up as well. Everything works when I go to another tty and execute sx or even startx.