summaryrefslogtreecommitdiffstats
path: root/tv/2configs/xserver
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2016-06-02 11:17:18 +0200
committermakefu <github@syntax-fehler.de>2016-06-02 11:17:18 +0200
commit4f28d9a306c2989304b52889c07e22992e40da0b (patch)
treed07166696ed3bd97bb6a165418af8611b8f68571 /tv/2configs/xserver
parentd5961aa09e399bb30f940eb5ac2cfe26dfa51d65 (diff)
parent7bd85d7bbbce68ba7317e16b805b1093ded3f1e2 (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'tv/2configs/xserver')
-rw-r--r--tv/2configs/xserver/Xmodmap.nix27
-rw-r--r--tv/2configs/xserver/default.nix87
2 files changed, 61 insertions, 53 deletions
diff --git a/tv/2configs/xserver/Xmodmap.nix b/tv/2configs/xserver/Xmodmap.nix
new file mode 100644
index 000000000..02b6c730e
--- /dev/null
+++ b/tv/2configs/xserver/Xmodmap.nix
@@ -0,0 +1,27 @@
+{ config, pkgs, ... }:
+
+with config.krebs.lib;
+
+pkgs.writeText "Xmodmap" ''
+ !keycode 66 = Caps_Lock
+ !remove Lock = Caps_Lock
+ clear Lock
+
+ ! caps lock
+ keycode 66 = Mode_switch
+
+ keycode 13 = 4 dollar EuroSign cent
+ keycode 30 = u U udiaeresis Udiaeresis
+ keycode 32 = o O odiaeresis Odiaeresis
+ keycode 38 = a A adiaeresis Adiaeresis
+ keycode 39 = s S ssharp
+
+ keycode 33 = p P Greek_pi Greek_PI
+ keycode 46 = l L Greek_lambda Greek_LAMBDA
+
+ keycode 54 = c C cacute Cacute
+
+ ! BULLET OPERATOR
+ keycode 17 = 8 asterisk U2219
+ keycode 27 = r R r U211D
+''
diff --git a/tv/2configs/xserver/default.nix b/tv/2configs/xserver/default.nix
index 4b936f473..b5b116786 100644
--- a/tv/2configs/xserver/default.nix
+++ b/tv/2configs/xserver/default.nix
@@ -37,15 +37,21 @@ let
pkgs.ff
pkgs.gitAndTools.qgit
pkgs.mpv
- pkgs.slock
pkgs.sxiv
pkgs.xsel
pkgs.zathura
];
- security.setuidPrograms = [
- "slock"
- ];
+ # 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;
+ };
+ };
systemd.services.display-manager.enable = false;
@@ -56,8 +62,8 @@ let
requires = [ "xserver.service" ];
environment = xmonad-environment;
serviceConfig = {
- ExecStart = "${xmonad-start}/bin/xmonad";
- ExecStop = "${xmonad-stop}/bin/xmonad-stop";
+ ExecStart = "${pkgs.xmonad-tv}/bin/xmonad-tv";
+ ExecStop = "${pkgs.xmonad-tv}/bin/xmonad-tv --shutdown";
User = user.name;
WorkingDirectory = user.home;
};
@@ -73,13 +79,30 @@ let
environment = xserver-environment;
serviceConfig = {
ExecReload = need-reload "xserver.service";
- ExecStart = "${xserver}/bin/xserver";
+ 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"
+ ];
};
};
};
xmonad-environment = {
DISPLAY = ":${toString config.services.xserver.display}";
+
+ XMONAD_STARTUP_HOOK = pkgs.writeDash "xmonad-startup-hook" ''
+ ${pkgs.xorg.xhost}/bin/xhost +LOCAL: &
+ ${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 :)
@@ -96,34 +119,6 @@ let
]);
};
- xmonad-start = pkgs.writeScriptBin "xmonad" ''
- #! ${pkgs.bash}/bin/bash
- set -efu
- export PATH; PATH=${makeSearchPath "bin" [
- # TODO put paths into a Haskell module instead of PATH
- pkgs.alsaUtils
- pkgs.rxvt_unicode
- ]}:/var/setuid-wrappers
- settle() {(
- # Use PATH for a clean journal
- command=''${1##*/}
- PATH=''${1%/*}; export PATH
- shift
- until "$command" "$@"; do
- ${pkgs.coreutils}/bin/sleep 1
- done
- )&}
- settle ${pkgs.xorg.xhost}/bin/xhost +LOCAL:
- settle ${pkgs.xorg.xrdb}/bin/xrdb -merge ${import ./Xresources.nix args}
- settle ${pkgs.xorg.xsetroot}/bin/xsetroot -solid '#1c1c1c'
- exec ${pkgs.xmonad-tv}/bin/xmonad
- '';
-
- xmonad-stop = pkgs.writeScriptBin "xmonad-stop" ''
- #! /bin/sh
- exec ${pkgs.xmonad-tv}/bin/xmonad --shutdown
- '';
-
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.
@@ -132,23 +127,9 @@ let
++ concatLists (catAttrs "libPath" config.services.xserver.drivers));
};
- xserver = pkgs.writeScriptBin "xserver" ''
- #! /bin/sh
- set -efu
- exec ${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 \
- '';
-
- need-reload = s: let
- pkg = pkgs.writeScriptBin "need-reload" ''
- #! /bin/sh
- echo "$*"
- '';
- in "${pkg}/bin/need-reload ${s}";
+ need-reload = s: toString [
+ "${pkgs.writeDashBin "need-reload" ''echo "$*"''}/bin/need-reload"
+ (shell.escape s)
+ ];
in out