tv: lol display-manager

This commit is contained in:
tv 2015-10-24 22:31:10 +02:00
parent b2deab26bd
commit 0306ec4294
15 changed files with 171 additions and 59 deletions

View File

@ -29,8 +29,7 @@ with lib;
#../2configs/consul-client.nix
../2configs/git.nix
../2configs/mail-client.nix
../2configs/xserver.nix
../2configs/synaptics.nix # TODO w110er if xserver is enabled
../2configs/xserver
../2configs/test.nix
{
environment.systemPackages = with pkgs; [

View File

@ -1,14 +0,0 @@
{ config, pkgs, ... }:
{
# TODO this is host specific
services.xserver.synaptics = {
enable = true;
twoFingerScroll = true;
accelFactor = "0.035";
additionalOptions = ''
Option "FingerHigh" "60"
Option "FingerLow" "60"
'';
};
}

View File

@ -47,6 +47,10 @@
# ref <stockholm/krebs/3modules>, services.openssh.knownHosts.github*
https://help.github.com/articles/what-ip-addresses-does-github-use-that-i-should-whitelist/
# <stockholm/tv/2configs/xserver/xserver.conf.nix>
# is derived from `configFile` in:
https://raw.githubusercontent.com/NixOS/nixpkgs/master/nixos/modules/services/x11/xserver.nix
];
};
}

View File

@ -1,41 +0,0 @@
{ config, pkgs, ... }:
{
imports = [
../2configs/urxvt.nix # TODO via xserver
];
services.xserver.enable = true;
#fonts.enableFontConfig = true;
#fonts.enableFontDir = true;
fonts.fonts = [
pkgs.xlibs.fontschumachermisc
];
#services.xfs.enable = true;
#services.xserver.useXFS = "unix/:7100";
services.xserver.displayManager.desktopManagerHandlesLidAndPower = true;
#services.xserver.display = 11;
#services.xserver.tty = 11;
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
#services.xserver.multitouch.enable = true;
services.xserver.windowManager.xmonad.extraPackages = hspkgs: with hspkgs; [
X11-xshape
];
services.xserver.windowManager.xmonad.enable = true;
services.xserver.windowManager.xmonad.enableContribAndExtras = true;
services.xserver.windowManager.default = "xmonad";
services.xserver.desktopManager.default = "none";
services.xserver.desktopManager.xterm.enable = false;
services.xserver.displayManager.slim.enable = true;
#services.xserver.displayManager.auto.enable = true;
#services.xserver.displayManager.auto.user = "tv";
#services.xserver.displayManager.job.logsXsession = true;
}

View File

@ -0,0 +1,126 @@
{ config, lib, pkgs, ... }@args:
with lib;
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 = [
pkgs.slock
];
security.setuidPrograms = [
"slock"
];
systemd.services.display-manager = mkForce {};
services.xserver.enable = true;
systemd.services.xmonad = {
wantedBy = [ "multi-user.target" ];
requires = [ "xserver.service" ];
serviceConfig = {
ExecStart = "${xmonad}/bin/xmonad";
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";
ExecStart = "${xserver}/bin/xserver";
};
};
};
xmonad = let
pkg = pkgs.haskellPackages.callPackage src {};
src = pkgs.runCommand "xmonad-package" {} ''
${pkgs.cabal2nix}/bin/cabal2nix ${./xmonad} > $out
'';
in pkgs.writeScriptBin "xmonad" ''
#! /bin/sh
set -efu
export DISPLAY; DISPLAY=:${toString config.services.xserver.display}
export PATH; PATH=${makeSearchPath "bin" [
pkgs.rxvt_unicode
]}
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 ${pkg}/bin/xmonad
'';
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));
};
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}";
in out

View File

@ -1 +0,0 @@
import ./xmonad-tv.nix

View File

@ -10,7 +10,6 @@ Executable xmonad
base,
containers,
filepath,
scanner,
X11,
X11-xshape,
xmonad,

View File

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.xserver;
in
pkgs.stdenv.mkDerivation {
name = "xserver.conf";
xfs = optionalString (cfg.useXFS != false)
''FontPath "${toString cfg.useXFS}"'';
inherit (cfg) config;
buildCommand =
''
echo 'Section "Files"' >> $out
echo $xfs >> $out
for i in ${toString config.fonts.fonts}; do
if test "''${i:0:''${#NIX_STORE}}" == "$NIX_STORE"; then
for j in $(find $i -name fonts.dir); do
echo " FontPath \"$(dirname $j)\"" >> $out
done
fi
done
for i in $(find ${toString cfg.modules} -type d); do
if test $(echo $i/*.so* | wc -w) -ne 0; then
echo " ModulePath \"$i\"" >> $out
fi
done
echo 'EndSection' >> $out
echo "$config" >> $out
'';
}