Trouble starting window manager

Hi there!

I’m having trouble setting up NixOS with i3 on a new machine. After booting, I see LightDM, but after typing in my credentials, I see “Failed to start session”.

Here are my configuration.nix, hardware-configuration.nix and home.nix (they are absolutely minimal) and the X.0.log: https://gist.github.com/corsinpfister/70f0e7bff46e90345aab9305916d8646

I’m relatively new to Nix(OS) and appreciate any help!

Update:
What’s odd: If I remove the xsession configuration from home.nix and set services.xserver.windowManager.i3.enable = true in configuration.nix, it works. But i would like to configure it per-user.

This example config can maybe help you out. It consists of two parts:

This was initially suggested by rycee: Opening i3 from home-manager automatically . Hopefully this addition makes it work for you.

EDIT: Why it works when you add it to the root config: because then you are hooking into the system-wide system for hooking up display and window managers. However if you install i3 through home-manager, the system-wide nix config does not know about “user” i3’s existence, and therefore you have to add some manual glue code to make it work. At least that’s my understanding as a nixos noob.