stockholm/tv/2configs/xserver/default.nix

136 lines
3.6 KiB
Nix
Raw Normal View History

2015-10-24 20:31:10 +00:00
{ config, lib, pkgs, ... }@args:
2016-02-14 15:43:44 +00:00
with config.krebs.lib;
2015-10-24 20:31:10 +00:00
let
# TODO krebs.build.user
user = config.users.users.tv;
out = {
services.xserver.display = 11;
services.xserver.tty = 11;
services.xserver.synaptics = {
enable = true;
twoFingerScroll = true;
accelFactor = "0.035";
};
fonts.fonts = [
pkgs.xlibs.fontschumachermisc
];
systemd.services.urxvtd = {
wantedBy = [ "multi-user.target" ];
reloadIfChanged = true;
serviceConfig = {
ExecReload = need-reload "urxvtd.service";
ExecStart = "${pkgs.rxvt_unicode}/bin/urxvtd";
Restart = "always";
RestartSec = "2s";
StartLimitBurst = 0;
User = user.name;
};
};
environment.systemPackages = [
2015-11-07 09:04:46 +00:00
pkgs.ff
pkgs.gitAndTools.qgit
pkgs.mpv
pkgs.sxiv
2015-11-07 18:24:25 +00:00
pkgs.xsel
2015-11-07 09:04:46 +00:00
pkgs.zathura
2015-10-24 20:31:10 +00:00
];
2016-05-25 01:03:21 +00:00
# TODO dedicated group, i.e. with a single user
# TODO krebs.setuid.slock.path vs /var/setuid-wrappers
krebs.setuid.slock = {
filename = "${pkgs.slock}/bin/slock";
group = "wheel";
envp = {
DISPLAY = ":${toString config.services.xserver.display}";
USER = user.name;
};
};
2015-10-24 20:31:10 +00:00
2015-12-27 22:12:01 +00:00
systemd.services.display-manager.enable = false;
2015-10-24 20:31:10 +00:00
services.xserver.enable = true;
2015-10-24 20:31:10 +00:00
systemd.services.xmonad = {
wantedBy = [ "multi-user.target" ];
requires = [ "xserver.service" ];
environment = xmonad-environment;
2015-10-24 20:31:10 +00:00
serviceConfig = {
ExecStart = "${pkgs.xmonad-tv}/bin/xmonad-tv";
ExecStop = "${pkgs.xmonad-tv}/bin/xmonad-tv --shutdown";
2015-10-24 20:31:10 +00:00
User = user.name;
WorkingDirectory = user.home;
};
};
systemd.services.xserver = {
after = [
"systemd-udev-settle.service"
"local-fs.target"
"acpid.service"
];
reloadIfChanged = true;
environment = xserver-environment;
serviceConfig = {
ExecReload = need-reload "xserver.service";
2016-05-24 23:50:06 +00:00
ExecStart = toString [
"${pkgs.xorg.xorgserver}/bin/X"
":${toString config.services.xserver.display}"
"vt${toString config.services.xserver.tty}"
"-config ${import ./xserver.conf.nix args}"
"-logfile /var/log/X.${toString config.services.xserver.display}.log"
"-nolisten tcp"
"-xkbdir ${pkgs.xkeyboard_config}/etc/X11/xkb"
];
2015-10-24 20:31:10 +00:00
};
};
};
xmonad-environment = {
DISPLAY = ":${toString config.services.xserver.display}";
XMONAD_STARTUP_HOOK = pkgs.writeDash "xmonad-startup-hook" ''
${pkgs.xorg.xhost}/bin/xhost +LOCAL: &
2016-05-25 00:36:24 +00:00
${pkgs.xorg.xmodmap}/bin/xmodmap ${import ./Xmodmap.nix args} &
${pkgs.xorg.xrdb}/bin/xrdb -merge ${import ./Xresources.nix args} &
${pkgs.xorg.xsetroot}/bin/xsetroot -solid '#1c1c1c' &
wait
'';
XMONAD_STATE = "/tmp/xmonad.state";
# XXX JSON is close enough :)
XMONAD_WORKSPACES0_FILE = pkgs.writeText "xmonad.workspaces0" (toJSON [
"Dashboard" # we start here
"23"
"cr"
"ff"
"hack"
"im"
"mail"
"stockholm"
2015-10-26 10:27:24 +00:00
"za" "zh" "zj" "zs"
]);
};
2015-10-24 20:31:10 +00:00
xserver-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" config.services.xserver.drivers));
};
2016-05-25 00:41:55 +00:00
need-reload = s: toString [
"${pkgs.writeDashBin "need-reload" ''echo "$*"''}/bin/need-reload"
(shell.escape s)
];
2015-10-24 20:31:10 +00:00
in out