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

182 lines
4.9 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;
xmonad.pkg = pkgs.haskellPackages.xmonad-tv.overrideAttrs (_: {
2020-10-03 01:34:32 +00:00
au = {
XMONAD_BUILD_SCREEN_WIDTH = 1920;
XMONAD_BUILD_TERM_FONT_WIDTH = 10;
XMONAD_BUILD_TERM_FONT = "xft:Input Mono:size=12:style=Regular";
XMONAD_BUILD_TERM_PADDING = 2;
};
}.${config.krebs.build.host.name} or {
XMONAD_BUILD_SCREEN_WIDTH = 1366;
XMONAD_BUILD_TERM_FONT_WIDTH = 6;
XMONAD_BUILD_TERM_FONT = "-*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-1";
XMONAD_BUILD_TERM_PADDING = 2;
});
2017-12-05 14:34:31 +00:00
};
2016-05-25 09:06:22 +00:00
in {
2019-04-24 21:44:37 +00:00
imports = [
2019-04-24 22:23:39 +00:00
./sxiv.nix
2019-04-24 22:17:25 +00:00
./urxvt.nix
2019-04-24 21:44:37 +00:00
];
2016-05-25 09:06:22 +00:00
environment.systemPackages = [
pkgs.ff
pkgs.font-size
2016-05-25 09:06:22 +00:00
pkgs.gitAndTools.qgit
pkgs.mpv
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
];
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;
2018-11-30 08:03:52 +00:00
systemd.services.xmonad = let
xmonad = "${cfg.xmonad.pkg}/bin/xmonad";
2019-02-08 17:02:29 +00:00
xmonad-start = pkgs.writeDash "xmonad-start" ''
2018-12-09 09:14:09 +00:00
${pkgs.coreutils}/bin/mkdir -p "$XMONAD_CACHE_DIR"
${pkgs.coreutils}/bin/mkdir -p "$XMONAD_CONFIG_DIR"
${pkgs.coreutils}/bin/mkdir -p "$XMONAD_DATA_DIR"
2019-02-08 17:02:29 +00:00
f=$HOME/.dbus/session-bus/$(${pkgs.coreutils}/bin/cat /etc/machine-id)-${
toString config.services.xserver.display
}
if test -e "$f" &&
. "$f" &&
${pkgs.coreutils}/bin/kill -0 "$DBUS_SESSION_BUS_PID"
then
export DBUS_SESSION_BUS_ADDRESS
else
eval "$(${pkgs.dbus.lib}/bin/dbus-launch --sh-syntax)"
fi
exec ${xmonad}
2018-12-09 09:14:09 +00:00
'';
xmonad-ready = pkgs.writeDash "xmonad-ready" ''
2019-04-25 01:32:35 +00:00
${pkgs.systemd}/bin/systemd-notify --ready
2018-12-09 09:14:09 +00:00
{
${pkgs.xorg.xhost}/bin/xhost +SI:localuser:${cfg.user.name}
${pkgs.xorg.xhost}/bin/xhost -LOCAL:
} &
${pkgs.xorg.xmodmap}/bin/xmodmap ${import ./Xmodmap.nix args} &
${pkgs.xorg.xsetroot}/bin/xsetroot -solid '#1c1c1c' &
wait
'';
2018-11-30 08:03:52 +00:00
in {
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}";
2018-11-28 08:55:38 +00:00
FZMENU_FZF_DEFAULT_OPTS = toString [
"--color=dark,border:126,bg+:090"
"--inline-info"
];
XMONAD_CACHE_DIR = cfg.cacheDir;
XMONAD_CONFIG_DIR = cfg.configDir;
XMONAD_DATA_DIR = cfg.dataDir;
2018-12-09 09:14:09 +00:00
XMONAD_STARTUP_HOOK = xmonad-ready;
XMONAD_WORKSPACES0_FILE = pkgs.writeJSON "xmonad-workspaces0.json" [
2016-05-25 09:06:22 +00:00
"Dashboard" # we start here
"23"
"cr"
"ff"
"hack"
"im"
"mail"
"stockholm"
"za" "zh" "zj" "zs"
2018-12-09 09:14:09 +00:00
];
2015-10-24 20:31:10 +00:00
};
2018-11-30 08:03:52 +00:00
path = [
2018-12-02 14:36:55 +00:00
config.tv.slock.package
2020-05-05 15:37:18 +00:00
(pkgs.flameshot-once.override {
config.imgur.enable = true;
config.imgur.createUrl = "http://ni.r/image";
config.imgur.deleteUrl = "http://ni.r/image/delete/%1";
config.imgur.xdg-open.browser = "/etc/profiles/per-user/tv/bin/cr";
config.timeout = 200;
})
2018-11-30 08:03:52 +00:00
pkgs.fzmenu
2018-11-30 15:17:32 +00:00
pkgs.pulseaudioLight.out
2018-11-30 08:03:52 +00:00
pkgs.rxvt_unicode
2018-12-02 14:43:49 +00:00
pkgs.xcalib
2018-12-02 14:36:55 +00:00
"/run/wrappers" # for su
2018-11-30 08:03:52 +00:00
];
2016-05-25 09:06:22 +00:00
serviceConfig = {
2019-02-08 17:02:29 +00:00
ExecStart = "@${xmonad-start} xmonad-${currentSystem}";
2018-11-30 08:03:52 +00:00
ExecStop = "@${xmonad} xmonad-${currentSystem} --shutdown";
2018-12-09 09:14:09 +00:00
SyslogIdentifier = "xmonad";
2017-12-05 14:34:31 +00:00
User = cfg.user.name;
WorkingDirectory = cfg.user.home;
2019-04-25 01:32:35 +00:00
NotifyAccess = "all";
Type = "notify";
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
];
};
};
2018-12-02 14:36:55 +00:00
tv.slock = {
enable = true;
user = cfg.user;
};
2016-05-25 09:06:22 +00:00
}