2017-12-03 22:00:24 +00:00
|
|
|
{ config, pkgs, ... }@args:
|
|
|
|
with import <stockholm/lib>;
|
|
|
|
let
|
|
|
|
|
|
|
|
out = {
|
|
|
|
options.lass.xserver = api;
|
|
|
|
config = mkIf cfg.enable imp;
|
|
|
|
};
|
|
|
|
|
|
|
|
user = config.krebs.build.user;
|
|
|
|
|
|
|
|
cfg = config.lass.xserver;
|
2017-12-04 10:52:00 +00:00
|
|
|
xcfg = config.services.xserver;
|
2017-12-03 22:00:24 +00:00
|
|
|
api = {
|
|
|
|
enable = mkEnableOption "lass xserver";
|
|
|
|
};
|
|
|
|
imp = {
|
|
|
|
|
|
|
|
services.xserver = {
|
|
|
|
enable = true;
|
|
|
|
display = 11;
|
|
|
|
tty = 11;
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.display-manager.enable = false;
|
|
|
|
|
|
|
|
systemd.services.xmonad = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
requires = [ "xserver.service" ];
|
|
|
|
environment = {
|
2017-12-04 10:52:00 +00:00
|
|
|
DISPLAY = ":${toString xcfg.display}";
|
2017-12-03 22:00:24 +00:00
|
|
|
|
|
|
|
XMONAD_STARTUP_HOOK = pkgs.writeDash "xmonad-startup-hook" ''
|
|
|
|
${pkgs.xorg.xhost}/bin/xhost +LOCAL: &
|
2017-12-04 10:52:00 +00:00
|
|
|
${xcfg.displayManager.sessionCommands}
|
2018-02-13 16:35:55 +00:00
|
|
|
if test -z "$DBUS_SESSION_BUS_ADDRESS"; then
|
|
|
|
exec ${pkgs.dbus.dbus-launch} --exit-with-session "$0" ""
|
|
|
|
fi
|
|
|
|
export DBUS_SESSION_BUS_ADDRESS
|
|
|
|
${config.systemd.package}/bin/systemctl --user import-environment DISPLAY DBUS_SESSION_BUS_ADDRESS
|
2017-12-03 22:00:24 +00:00
|
|
|
wait
|
|
|
|
'';
|
|
|
|
|
|
|
|
XMONAD_DATA_DIR = "/tmp";
|
|
|
|
};
|
|
|
|
serviceConfig = {
|
|
|
|
SyslogIdentifier = "xmonad";
|
|
|
|
ExecStart = "${pkgs.xmonad-lass}/bin/xmonad";
|
|
|
|
ExecStop = "${pkgs.xmonad-lass}/bin/xmonad --shutdown";
|
|
|
|
User = user.name;
|
|
|
|
WorkingDirectory = user.home;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.services.xserver = {
|
|
|
|
after = [
|
|
|
|
"systemd-udev-settle.service"
|
|
|
|
"local-fs.target"
|
|
|
|
"acpid.service"
|
|
|
|
];
|
|
|
|
reloadIfChanged = true;
|
|
|
|
environment = {
|
|
|
|
XKB_BINDIR = "${pkgs.xorg.xkbcomp}/bin"; # Needed for the Xkb extension.
|
|
|
|
XORG_DRI_DRIVER_PATH = "/run/opengl-driver/lib/dri"; # !!! Depends on the driver selected at runtime.
|
|
|
|
LD_LIBRARY_PATH = concatStringsSep ":" (
|
|
|
|
[ "${pkgs.xorg.libX11}/lib" "${pkgs.xorg.libXext}/lib" ]
|
2017-12-04 10:52:00 +00:00
|
|
|
++ concatLists (catAttrs "libPath" xcfg.drivers));
|
2017-12-03 22:00:24 +00:00
|
|
|
};
|
|
|
|
serviceConfig = {
|
|
|
|
SyslogIdentifier = "xserver";
|
|
|
|
ExecReload = "${pkgs.coreutils}/bin/echo NOP";
|
|
|
|
ExecStart = toString [
|
|
|
|
"${pkgs.xorg.xorgserver}/bin/X"
|
2017-12-04 10:52:00 +00:00
|
|
|
":${toString xcfg.display}"
|
|
|
|
"vt${toString xcfg.tty}"
|
2017-12-03 22:00:24 +00:00
|
|
|
"-config ${import ./xserver.conf.nix args}"
|
|
|
|
"-logfile /dev/null -logverbose 0 -verbose 3"
|
|
|
|
"-nolisten tcp"
|
|
|
|
"-xkbdir ${pkgs.xkeyboard_config}/etc/X11/xkb"
|
2017-12-04 10:52:00 +00:00
|
|
|
(optional (xcfg.dpi != null) "-dpi ${toString xcfg.dpi}")
|
2017-12-03 22:00:24 +00:00
|
|
|
];
|
2018-02-13 16:35:55 +00:00
|
|
|
User = user.name;
|
2017-12-03 22:00:24 +00:00
|
|
|
};
|
|
|
|
};
|
2017-12-15 18:55:02 +00:00
|
|
|
krebs.xresources.resources.dpi = ''
|
2017-12-04 10:52:00 +00:00
|
|
|
${optionalString (xcfg.dpi != null) "Xft.dpi: ${toString xcfg.dpi}"}
|
|
|
|
'';
|
2017-12-03 22:00:24 +00:00
|
|
|
systemd.services.urxvtd = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
reloadIfChanged = true;
|
|
|
|
serviceConfig = {
|
|
|
|
SyslogIdentifier = "urxvtd";
|
|
|
|
ExecReload = "${pkgs.coreutils}/bin/echo NOP";
|
|
|
|
ExecStart = "${pkgs.rxvt_unicode_with-plugins}/bin/urxvtd";
|
|
|
|
Restart = "always";
|
|
|
|
RestartSec = "2s";
|
|
|
|
StartLimitBurst = 0;
|
|
|
|
User = user.name;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in out
|