Created an all-hardware NixOS installation that works on my desktop, laptop, and vm - but not on steamdeck

I’m very new to NixOS but I have managed to set up a decent starter dev environment for myself.

It’s installed on an external USB disk with encryption and my goal was to set it up so it can boot from multiple machines with different hardware configurations.

That also does work to a certain extend since it can boot from my main desktop PC, my laptop, and inside VirtualBox (using the USB pass-through) running on my desktop PC.

But it doesn’t want to boot on my Steamdeck and I’m not sure why. It seems others have gotten NixOS to work on Steamdeck but I don’t know if that was accomplished by using the internal drive.

On the Steamdeck - after I select the USB as boot drive I get the menu where I can select the current generation. After selecting a working generation I get the following error:

くくく NixOS Stage 1>>>

loading module dm_mod...
Running udev...
Starting systemd-udevd version 254.6

Waiting 10 seconds for device /dev/disk/by-uuid/040f1634-df6e-4b03-9f0a-07d903fd6d3d to appear........... - failure

/dev/disk/by-uuid/040f1634-df6e-4b03-9f0a-07d903fd6d3d is unavailable

An error occurred in stage 1 of the boot process, which must mount the root filesystem on /mnt-root and then start stage 2. Press one of the following keys:

r) to reboot immediately
*) to ignore the error and continue

Pressing either r or * will not do anything.

Normally I would have to enter the encryption password at this point but I don’t even get that far.

I’m not sure what the issue is. I’m guessing it’s something to do with the USB drive not being recognized properly but I’m not sure how to fix it.

My hardware-configuration is as follows:

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ 
      #(modulesPath + "/profiles/qemu-guest.nix")
      (modulesPath + "/profiles/all-hardware.nix")
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "ohci_pci" "ehci_pci" "virtio_pci" "ahci" "usbhid" "sr_mod" "virtio_blk" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/c1d90bb8-804b-45ec-80bf-c549ae41f275";
      fsType = "ext4";
    };

  boot.initrd.luks.devices."luks-040f1634-df6e-4b03-9f0a-07d903fd6d3d".device = "/dev/disk/by-uuid/040f1634-df6e-4b03-9f0a-07d903fd6d3d";

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/F820-2E9A";
      fsType = "vfat";
    };

  swapDevices =
    [ { device = "/dev/disk/by-uuid/aa233eb0-e445-4f17-888c-e6a79e78d904"; }
    ];

  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  # (the default) this is the recommended approach. When using systemd-networkd it's
  # still possible to use this option, but it's recommended to use it in conjunction
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  networking.useDHCP = lib.mkDefault true;
  # networking.interfaces.enp0s9.useDHCP = lib.mkDefault true;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

The only thing I changed here from the original generated config is the

#(modulesPath + "/profiles/qemu-guest.nix")
(modulesPath + "/profiles/all-hardware.nix")

part where I commented out the qemu-guest and added all-hardware.
This got it working on my desktop PC and laptop. But sadly not on the Steamdeck.

Any pointers on what I could try to fix this would be greatly appreciated.

Thanks in advance!