Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Last active January 31, 2023 14:46
Show Gist options
  • Save CMCDragonkai/42bd028478d8183162ea7d9b69cd5e31 to your computer and use it in GitHub Desktop.
Save CMCDragonkai/42bd028478d8183162ea7d9b69cd5e31 to your computer and use it in GitHub Desktop.
NixOS: Ordering of X Startup Scripts

Ordering of X Startup Scripts

This is specific to NixOS.

There are 2 cases, the text mode case, and the graphical mode case. This is the graphical mode case:

  1. Bootup (systemd services)
  2. Runs systemctl start display-manager either automatically or via terminal.
  3. Launch Display Manager (Runs Display Manager Initialisation)
  4. Launch X for the Display Manager (this doesn't run xserverrc nor xinitrc)
  5. Login Occurs
  6. PAM executes relevant routines. (Which could involve pam_env.so loading ~/.pam_environment.)
  7. Runs Session Script (Starts DBUS, Starts GPGAgent, Starts PulseAudio, Sets up X logging, Loads ~/.Xresources and ~/.Xdefaults and ~/.xprofile, Optionally exec with ~/.xsession replacing the current session.)
  8. 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):

  1. Bootup (systemd services).
  2. Login into text console.
  3. PAM executes relevant routines. (Which could involve pam_env.so loading ~/.pam_environment.)
  4. Login shell executes startup routines.
  5. Runs startx via the terminal.
  6. Launches X by running xinit and runs ~/.xserverrc and ~/.xinitrc (if these files don't exist there are default packaged xserverrc and xinitrc and their locations are dependent on the distribution).
  7. Launches Window/DesktopManager (Runs Autostart Scripts)

Here are the references:

For XMonad, its autostart scripts is just whatever is coded into ~/.xmonad/xmonad.hs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment