Issue initializing graphical sway session in minimal install

hey, very new to nix, so sorry if I’m missing something basic.
I’m trying to make a liveUSB(config file here), and the goal is to start in a tty, and start a sway session optionally.

when I turn on sway debug, the last info message I get is

[wlr] [backend/session/session.c:473] Waiting for a DRM card device

then I get found 0 gpus

some things I’ve noticed

  1. /run/user/1000/wayland-0 does not exists
  2. path /dev/dri doesn’t exists, which from what I understand is supposed to be created by the kernel.
  3. I’m not seeing any errors in dmesg

given 2 I’m guessing I 'm supposed to add something to the boot or kernel config that I haven’t. relevant sections of my config

hardware = {
                cpu.amd.updateMicrocode = true;
                #enableAllFirmware = true;
                enableRedistributableFirmware = true;
                opengl = {
                  enable = true;
                  driSupport = true;
                  driSupport32Bit = true;
                  extraPackages = [ pkgs.vulkan-validation-layers pkgs.vaapiVdpau pkgs.libvdpau-va-gl ];
                };
                ...
                
              };
              ...

              boot = {
                tmp.cleanOnBoot = true;
                kernel.sysctl = {"kernel.unprivileged_bpf_disabled" = 1;};
              };

services = {
                ...
                xserver = {
                  enable = true;
                  videoDrivers = [ "amdgpu" "modesetting" "fbdev" ];
                  
                };

Also, searching for similar issues this comes up but it looks like his is failing at an earlier point, and I have polkit enabled in my config

I think this is because of WLR_RENDERER=vulkan. I’m pretty sure this is only supported in Sway 1.9+, which just released a day or two ago and isn’t merged into nixpkgs yet from what I can tell.

that variable is only set(or should only be set) if I launch with the swaystart, but script, but I’m running into the issue when launching sway directly.

I don’t think it’s an issue with sway at all. I suspect it’s a missing hardware or kernel configuration given the path /dev/dri/ doesn’t exist

A bit more info: lsmod | grep VGA doesn’t return anything. I found where I need to add amdgpu to boot.initrd.kernelModules`, do I need to add anything for modesetting and fbdev (the default video drivers)?

It seems setting boot.initrd.KernelModules to [ "amdgpu" ] causes the build to fail because squashfs isn’t loaded.
I looked under the options for boot.initrd.KernelModules and it’s set to [] by default, so either something is expecting this to be empty and loading defaults if so, or this is overriding it being set somewhere else. if the latter, is there anyway to append the module?

for anyone who runs into this in the future, this addition to my flake is what fixed it:

 boot.kernelPackages = pkgs.linuxPackages_latest;
              ...
              boot.initrd.kernelModules = [ "amdgpu" ];

I’m not exactly sure if the amdgpu module addition is necessary, or why specifying the latest kernel resolved the problem(I assumed that the latest kernel would be the default). but, eh, it doesn’t hurt to document which lever lead to the food pellet