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

146 lines
3.7 KiB
Nix
Raw Normal View History

2016-05-25 09:06:22 +00:00
{ config, pkgs, ... }@args:
2016-10-20 18:54:38 +00:00
with import <stockholm/lib>;
2015-10-24 20:31:10 +00:00
let
2017-12-05 14:34:31 +00:00
cfg = {
cacheDir = cfg.dataDir;
configDir = "/var/empty";
dataDir = "/run/xdg/${cfg.user.name}/xmonad";
2017-12-05 14:34:31 +00:00
user = config.krebs.build.user;
};
2016-05-25 09:06:22 +00:00
in {
environment.systemPackages = [
pkgs.ff
pkgs.font-size
2016-05-25 09:06:22 +00:00
pkgs.gitAndTools.qgit
pkgs.mpv
pkgs.sxiv
2017-07-12 19:18:19 +00:00
pkgs.xdotool
2016-05-25 09:06:22 +00:00
pkgs.xsel
pkgs.zathura
];
fonts.fonts = [
pkgs.xlibs.fontschumachermisc
];
2016-05-25 09:29:20 +00:00
# TODO dedicated group, i.e. with a single user [per-user-setuid]
# TODO krebs.setuid.slock.path vs /run/wrappers/bin
2016-05-25 09:06:22 +00:00
krebs.setuid.slock = {
filename = "${pkgs.slock}/bin/slock";
group = "wheel";
envp = {
DISPLAY = ":${toString config.services.xserver.display}";
2017-12-05 14:34:31 +00:00
USER = cfg.user.name;
2016-05-25 09:06:22 +00:00
};
};
2015-10-24 20:31:10 +00:00
2016-05-25 09:06:22 +00:00
services.xserver = {
# Don't install feh into systemPackages
# refs <nixpkgs/nixos/modules/services/x11/desktop-managers>
desktopManager.session = mkForce [];
2018-10-06 21:48:20 +00:00
displayManager.lightdm.enable = mkForce false;
displayManager.job.execCmd = mkForce "derp";
2016-05-25 09:06:22 +00:00
enable = true;
2018-10-06 17:32:25 +00:00
display = mkForce 11;
tty = mkForce 11;
2015-10-24 20:31:10 +00:00
2016-05-25 09:06:22 +00:00
synaptics = {
2015-10-24 20:31:10 +00:00
enable = true;
twoFingerScroll = true;
accelFactor = "0.035";
};
2016-05-25 09:06:22 +00:00
};
2015-10-24 20:31:10 +00:00
2016-05-25 09:06:22 +00:00
systemd.services.display-manager.enable = false;
systemd.services.xmonad = {
2018-10-07 07:54:55 +00:00
wantedBy = [ "graphical.target" ];
2016-05-25 09:06:22 +00:00
requires = [ "xserver.service" ];
environment = {
DISPLAY = ":${toString config.services.xserver.display}";
XMONAD_CACHE_DIR = cfg.cacheDir;
XMONAD_CONFIG_DIR = cfg.configDir;
XMONAD_DATA_DIR = cfg.dataDir;
2016-05-25 09:06:22 +00:00
XMONAD_STARTUP_HOOK = pkgs.writeDash "xmonad-startup-hook" ''
${pkgs.xorg.xhost}/bin/xhost +LOCAL: &
${pkgs.xorg.xmodmap}/bin/xmodmap ${import ./Xmodmap.nix args} &
2017-07-12 19:18:45 +00:00
${pkgs.xorg.xrdb}/bin/xrdb ${import ./Xresources.nix args} &
2016-05-25 09:06:22 +00:00
${pkgs.xorg.xsetroot}/bin/xsetroot -solid '#1c1c1c' &
wait
'';
# XXX JSON is close enough :)
XMONAD_WORKSPACES0_FILE = pkgs.writeText "xmonad.workspaces0" (toJSON [
"Dashboard" # we start here
"23"
"cr"
"ff"
"hack"
"im"
"mail"
"stockholm"
"za" "zh" "zj" "zs"
]);
2015-10-24 20:31:10 +00:00
};
2016-05-25 09:06:22 +00:00
serviceConfig = {
SyslogIdentifier = "xmonad";
ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${toString [
"\${XMONAD_CACHE_DIR}"
"\${XMONAD_CONFIG_DIR}"
"\${XMONAD_DATA_DIR}"
]}";
ExecStart = "${pkgs.xmonad-tv}/bin/xmonad";
ExecStop = "${pkgs.xmonad-tv}/bin/xmonad --shutdown";
2017-12-05 14:34:31 +00:00
User = cfg.user.name;
WorkingDirectory = cfg.user.home;
2016-05-25 01:03:21 +00:00
};
2016-05-25 09:06:22 +00:00
};
2015-10-24 20:31:10 +00:00
2016-05-25 09:06:22 +00:00
systemd.services.xserver = {
after = [
"acpid.service"
2018-10-07 07:54:55 +00:00
"local-fs.target"
"systemd-udev-settle.service"
];
wants = [
"systemd-udev-settle.service"
2016-05-25 09:06:22 +00:00
];
2018-10-07 07:54:55 +00:00
restartIfChanged = false;
2016-05-25 09:06:22 +00:00
environment = {
2018-10-07 07:54:55 +00:00
LD_LIBRARY_PATH = concatStringsSep ":" ([ "/run/opengl-driver/lib" ]
2016-05-25 09:06:22 +00:00
++ concatLists (catAttrs "libPath" config.services.xserver.drivers));
2015-10-24 20:31:10 +00:00
};
2016-05-25 09:06:22 +00:00
serviceConfig = {
SyslogIdentifier = "xserver";
2016-05-25 09:06:22 +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 /dev/null -logverbose 0 -verbose 3"
2016-05-25 09:06:22 +00:00
"-nolisten tcp"
2018-10-07 07:54:55 +00:00
"-xkbdir ${config.services.xserver.xkbDir}"
2015-10-24 20:31:10 +00:00
];
};
};
2016-05-25 09:06:22 +00:00
systemd.services.urxvtd = {
2018-10-07 07:54:55 +00:00
wantedBy = [ "graphical.target" ];
restartIfChanged = false;
2016-05-25 09:06:22 +00:00
serviceConfig = {
SyslogIdentifier = "urxvtd";
2016-05-25 09:06:22 +00:00
ExecStart = "${pkgs.rxvt_unicode}/bin/urxvtd";
Restart = "always";
RestartSec = "2s";
StartLimitBurst = 0;
2017-12-05 14:34:31 +00:00
User = cfg.user.name;
2016-05-25 09:06:22 +00:00
};
2015-10-24 20:31:10 +00:00
};
2016-05-25 09:06:22 +00:00
}