FYI to both of you, nothing in environment.systemPackages has anything to do with TPM2 disk unlocking. And @FStefanni lanzaboote should be just fine with the TPM2, and preLVM has no effect with systemd-initrd.
I helped someone diagnose why their system stopped working with TPM2 auto-unlocking last night, and I believe we’ve identified a NixOS bug that’s appeared recently. I’m going to be opening a PR with a fix, a bit of code cleanup, and some improved documentation here very soon.
In the meantime, the other person’s fix was to include some new systemd dependencies. This is what I’ll be upstreaming to NixOS in the next day hopefully.
@ElvishJerricco Can you please link here the PR or the Issue? Also how do you debug these issues? Sorry for dummy question, but how can I obtain logs from initrd systemd?
Just wanted to say thanks, this line was what did the trick for me. The only other things I did earlier were 1) systemd-cryptenroll command from above and 2) add crypttabExtraOpts = [ "tpm2-device=auto" ]; in Disko. I have removed all the other tpm2* related settings (incl. kernel modules and packages) from configuration.nix, and it still works now!