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-manager
either automatically or via terminal. - Launch Display Manager (Runs Display Manager Initialisation)
- Launch X for the Display Manager (this doesn't run
xserverrc
norxinitrc
) - Login Occurs
- PAM executes relevant routines. (Which could involve
pam_env.so
loading~/.pam_environment
.) - Runs Session Script (Starts DBUS, Starts GPGAgent, Starts PulseAudio, Sets up X logging, Loads
~/.Xresources
and~/.Xdefaults
and~/.xprofile
, Optionallyexec
with~/.xsession
replacing 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.so
loading~/.pam_environment
.) - Login shell executes startup routines.
- Runs
startx
via the terminal. - Launches X by running
xinit
and runs~/.xserverrc
and~/.xinitrc
(if these files don't exist there are default packagedxserverrc
andxinitrc
and 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
xinitrc
andxserverrc
: 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
.