Using X without a Display Manager: Difference between revisions
imported>Samueldr m Adds a note/warning about how this isn't best practices |
imported>Doronbehar Add method of startx as displayManager and mention D-Bus issues' fix |
||
Line 1: | Line 1: | ||
{{note|This page is a WIP, it doesn't describe best-practices with nix and NixOS and should be updated to use a nix derivation generating the necessary files instead of manipulating the contents of the store.}} | {{note|This page is a WIP, it doesn't describe best-practices with nix and NixOS and should be updated to use a nix derivation generating the necessary files instead of manipulating the contents of the store.}} | ||
== Setting up Xorg without system wide modifications == | |||
To run X11 as a regular user, ''without'' <code>services.xserver.enable = true;</code> in configuration.nix, do the following: | To run X11 as a regular user, ''without'' <code>services.xserver.enable = true;</code> in configuration.nix, do the following: | ||
Line 82: | Line 84: | ||
<syntaxhighlight lang="sh"> | <syntaxhighlight lang="sh"> | ||
startx -- :0 -configdir ~/.config/xorg.conf.d | startx -- :0 -configdir ~/.config/xorg.conf.d | ||
</syntaxhighlight> | |||
== Setting up Xorg system-wide but without a Display Manager == | |||
If you don't mind having <code>services.xserver.enable = true;</code> but you don't want a display manager, and you want only a TTY login prompt, use the following in your <code>configuration.nix</code>: | |||
<syntaxhighlight lang="nix"> | |||
services.xserver.displayManager.startx.enable = true; | |||
</syntaxhighlight> | |||
<code>startx</code> is treated as a displayManager and therefor it is used instead of the default (<code>lightdm</code>). | |||
== Setting up the user's D-Bus Daemon == | |||
Both of the methods above, don't start the user's dbus-daemon properly on startup. Unfortunately, it is unclear exactly why this is missing, but here's a fix for startx users: | |||
Put the following in your <code>~/.xinitrc</code>: | |||
<syntaxhighlight lang="sh"> | |||
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then | |||
eval $(dbus-launch --exit-with-session --sh-syntax) | |||
fi | |||
systemctl --user import-environment DISPLAY XAUTHORITY | |||
if command -v dbus-update-activation-environment >/dev/null 2>&1; then | |||
dbus-update-activation-environment DISPLAY XAUTHORITY | |||
fi | |||
</syntaxhighlight> | </syntaxhighlight> |