This is specific to NixOS.
There are 2 cases, the text mode case, and the graphical mode case. This is the graphical mode case:
- Bootup (systemd services)
- Runs
systemctl start display-managereither automatically or via terminal. - Launch Display Manager (Runs Display Manager Initialisation)
- Launch X for the Display Manager (this doesn't run
xserverrcnorxinitrc) - Login Occurs
- PAM executes relevant routines. (Which could involve
pam_env.soloading~/.pam_environment.) - Runs Session Script (Starts DBUS, Starts GPGAgent, Starts PulseAudio, Sets up X logging, Loads
~/.Xresourcesand~/.Xdefaultsand~/.xprofile, Optionallyexecwith~/.xsessionreplacing the current session.) - Launch Window Manager/Desktop Environment (Runs XDG Autostart Scripts)
In the case of a text mode it's just (however on NixOS, this doesn't seem possible):
- Bootup (systemd services).
- Login into text console.
- PAM executes relevant routines. (Which could involve
pam_env.soloading~/.pam_environment.) - Login shell executes startup routines.
- Runs
startxvia the terminal. - Launches X by running
xinitand runs~/.xserverrcand~/.xinitrc(if these files don't exist there are default packagedxserverrcandxinitrcand their locations are dependent on the distribution). - Launches Window/DesktopManager (Runs Autostart Scripts)
Here are the references:
- Systemd Services: https://www.freedesktop.org/software/systemd/man/systemd.service.html
- Display Manager Initialisation (usually called
XSetup): http://unix.stackexchange.com/q/42611/56970 (for SDDM: see https://github.com/sddm/sddm/tree/master/data/scripts) - The
xinitrcandxserverrc: https://wiki.archlinux.org/index.php/Xinit - Session Script: https://github.com/NixOS/nixpkgs/blob/01c197df689a9794885a80d965311696377e0efb/nixos/modules/services/x11/display-managers/default.nix#L30-L148
- Autostart Scripts: https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html#startup and https://wiki.archlinux.org/index.php/autostarting#Graphical
For XMonad, its autostart scripts is just whatever is coded into ~/.xmonad/xmonad.hs.