diff --git a/modules/xsession.nix b/modules/xsession.nix index c980a00f3..81ecd254d 100644 --- a/modules/xsession.nix +++ b/modules/xsession.nix @@ -188,10 +188,13 @@ in hm-graphical-session = { Unit = { Description = "Home Manager X session"; - Requires = [ - "graphical-session-pre.target" - "xdg-desktop-autostart.target" - ]; + Requires = + let + requires = lib.optional (config.xdg.autostart.enable) "xdg-desktop-autostart.target" ++ [ + "graphical-session-pre.target" + ]; + in + requires; BindsTo = [ "graphical-session.target" "tray.target"