diff options
author | lassulus <lassulus@lassul.us> | 2017-12-05 18:46:48 +0100 |
---|---|---|
committer | lassulus <lassulus@lassul.us> | 2017-12-05 18:46:48 +0100 |
commit | 8030352c450432a0cee14f561241831875f8399b (patch) | |
tree | 832fc539497da14ec7d90e1540cb8093ca63cfbd /lass/3modules/xserver/default.nix | |
parent | 18fad9c618be468d3a8e902ee2e23143e598163c (diff) | |
parent | 704096c93e91f0b71d257028401b52d6da03c073 (diff) |
Merge branch 'prism/master' into HEAD
Diffstat (limited to 'lass/3modules/xserver/default.nix')
-rw-r--r-- | lass/3modules/xserver/default.nix | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/lass/3modules/xserver/default.nix b/lass/3modules/xserver/default.nix new file mode 100644 index 000000000..462c6deef --- /dev/null +++ b/lass/3modules/xserver/default.nix @@ -0,0 +1,101 @@ +{ 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; + xcfg = config.services.xserver; + api = { + enable = mkEnableOption "lass xserver"; + }; + imp = { + + services.xserver = { + # Don't install feh into systemPackages + # refs <nixpkgs/nixos/modules/services/x11/desktop-managers> + desktopManager.session = mkForce []; + + enable = true; + display = 11; + tty = 11; + }; + + systemd.services.display-manager.enable = false; + + systemd.services.xmonad = { + wantedBy = [ "multi-user.target" ]; + requires = [ "xserver.service" ]; + environment = { + DISPLAY = ":${toString xcfg.display}"; + + XMONAD_STARTUP_HOOK = pkgs.writeDash "xmonad-startup-hook" '' + ${pkgs.xorg.xhost}/bin/xhost +LOCAL: & + ${xcfg.displayManager.sessionCommands} + 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" ] + ++ concatLists (catAttrs "libPath" xcfg.drivers)); + }; + serviceConfig = { + SyslogIdentifier = "xserver"; + ExecReload = "${pkgs.coreutils}/bin/echo NOP"; + ExecStart = toString [ + "${pkgs.xorg.xorgserver}/bin/X" + ":${toString xcfg.display}" + "vt${toString xcfg.tty}" + "-config ${import ./xserver.conf.nix args}" + "-logfile /dev/null -logverbose 0 -verbose 3" + "-nolisten tcp" + "-xkbdir ${pkgs.xkeyboard_config}/etc/X11/xkb" + (optional (xcfg.dpi != null) "-dpi ${toString xcfg.dpi}") + ]; + }; + }; + services.xresources.resources.dpi = '' + ${optionalString (xcfg.dpi != null) "Xft.dpi: ${toString xcfg.dpi}"} + ''; + 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 |