diff options
author | tv <tv@krebsco.de> | 2015-10-24 22:31:10 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2015-10-24 22:31:10 +0200 |
commit | 336394d8616ee094dff11634bb564c26ab012ac0 (patch) | |
tree | 71ef3de884ac18f19788964023e71a80d872aa1f | |
parent | b1f7c03ecdde2593045ab80a2b94de1ff4d32178 (diff) |
tv: lol display-manager
-rw-r--r-- | tv/1systems/wu.nix | 3 | ||||
-rw-r--r-- | tv/2configs/synaptics.nix | 14 | ||||
-rw-r--r-- | tv/2configs/urlwatch.nix | 4 | ||||
-rw-r--r-- | tv/2configs/xserver.nix | 41 | ||||
-rw-r--r-- | tv/2configs/xserver/default.nix | 126 | ||||
-rw-r--r-- | tv/2configs/xserver/xmonad-tv/default.nix | 1 | ||||
-rw-r--r-- | tv/2configs/xserver/xmonad/Main.hs (renamed from tv/2configs/xserver/xmonad-tv/Main.hs) | 0 | ||||
-rw-r--r-- | tv/2configs/xserver/xmonad/Util/Debunk.hs (renamed from tv/2configs/xserver/xmonad-tv/Util/Debunk.hs) | 0 | ||||
-rw-r--r-- | tv/2configs/xserver/xmonad/Util/Font.hs (renamed from tv/2configs/xserver/xmonad-tv/Util/Font.hs) | 0 | ||||
-rw-r--r-- | tv/2configs/xserver/xmonad/Util/Pager.hs (renamed from tv/2configs/xserver/xmonad-tv/Util/Pager.hs) | 0 | ||||
-rw-r--r-- | tv/2configs/xserver/xmonad/Util/Rhombus.hs (renamed from tv/2configs/xserver/xmonad-tv/Util/Rhombus.hs) | 0 | ||||
-rw-r--r-- | tv/2configs/xserver/xmonad/Util/Submap.hs (renamed from tv/2configs/xserver/xmonad-tv/Util/Submap.hs) | 0 | ||||
-rw-r--r-- | tv/2configs/xserver/xmonad/Util/XUtils.hs (renamed from tv/2configs/xserver/xmonad-tv/Util/XUtils.hs) | 0 | ||||
-rw-r--r-- | tv/2configs/xserver/xmonad/xmonad.cabal (renamed from tv/2configs/xserver/xmonad-tv/xmonad-tv.cabal) | 1 | ||||
-rw-r--r-- | tv/2configs/xserver/xserver.conf.nix | 40 |
15 files changed, 171 insertions, 59 deletions
diff --git a/tv/1systems/wu.nix b/tv/1systems/wu.nix index 89ad257..987748d 100644 --- a/tv/1systems/wu.nix +++ b/tv/1systems/wu.nix @@ -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; [ diff --git a/tv/2configs/synaptics.nix b/tv/2configs/synaptics.nix deleted file mode 100644 index c47cb9d..0000000 --- a/tv/2configs/synaptics.nix +++ /dev/null @@ -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" - ''; - }; -} diff --git a/tv/2configs/urlwatch.nix b/tv/2configs/urlwatch.nix index 373803c..8189f63 100644 --- a/tv/2configs/urlwatch.nix +++ b/tv/2configs/urlwatch.nix @@ -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 ]; }; } diff --git a/tv/2configs/xserver.nix b/tv/2configs/xserver.nix deleted file mode 100644 index 7fc07f9..0000000 --- a/tv/2configs/xserver.nix +++ /dev/null @@ -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; -} diff --git a/tv/2configs/xserver/default.nix b/tv/2configs/xserver/default.nix new file mode 100644 index 0000000..b590fbd --- /dev/null +++ b/tv/2configs/xserver/default.nix @@ -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 diff --git a/tv/2configs/xserver/xmonad-tv/default.nix b/tv/2configs/xserver/xmonad-tv/default.nix deleted file mode 100644 index f0cb8e0..0000000 --- a/tv/2configs/xserver/xmonad-tv/default.nix +++ /dev/null @@ -1 +0,0 @@ -import ./xmonad-tv.nix diff --git a/tv/2configs/xserver/xmonad-tv/Main.hs b/tv/2configs/xserver/xmonad/Main.hs index a298d72..a298d72 100644 --- a/tv/2configs/xserver/xmonad-tv/Main.hs +++ b/tv/2configs/xserver/xmonad/Main.hs diff --git a/tv/2configs/xserver/xmonad-tv/Util/Debunk.hs b/tv/2configs/xserver/xmonad/Util/Debunk.hs index b4772e5..b4772e5 100644 --- a/tv/2configs/xserver/xmonad-tv/Util/Debunk.hs +++ b/tv/2configs/xserver/xmonad/Util/Debunk.hs diff --git a/tv/2configs/xserver/xmonad-tv/Util/Font.hs b/tv/2configs/xserver/xmonad/Util/Font.hs index 5352cf5..5352cf5 100644 --- a/tv/2configs/xserver/xmonad-tv/Util/Font.hs +++ b/tv/2configs/xserver/xmonad/Util/Font.hs diff --git a/tv/2configs/xserver/xmonad-tv/Util/Pager.hs b/tv/2configs/xserver/xmonad/Util/Pager.hs index b8168b5..b8168b5 100644 --- a/tv/2configs/xserver/xmonad-tv/Util/Pager.hs +++ b/tv/2configs/xserver/xmonad/Util/Pager.hs diff --git a/tv/2configs/xserver/xmonad-tv/Util/Rhombus.hs b/tv/2configs/xserver/xmonad/Util/Rhombus.hs index 5f43cb2..5f43cb2 100644 --- a/tv/2configs/xserver/xmonad-tv/Util/Rhombus.hs +++ b/tv/2configs/xserver/xmonad/Util/Rhombus.hs diff --git a/tv/2configs/xserver/xmonad-tv/Util/Submap.hs b/tv/2configs/xserver/xmonad/Util/Submap.hs index b09b97c..b09b97c 100644 --- a/tv/2configs/xserver/xmonad-tv/Util/Submap.hs +++ b/tv/2configs/xserver/xmonad/Util/Submap.hs diff --git a/tv/2configs/xserver/xmonad-tv/Util/XUtils.hs b/tv/2configs/xserver/xmonad/Util/XUtils.hs index de1d824..de1d824 100644 --- a/tv/2configs/xserver/xmonad-tv/Util/XUtils.hs +++ b/tv/2configs/xserver/xmonad/Util/XUtils.hs diff --git a/tv/2configs/xserver/xmonad-tv/xmonad-tv.cabal b/tv/2configs/xserver/xmonad/xmonad.cabal index 72494ab..00acf17 100644 --- a/tv/2configs/xserver/xmonad-tv/xmonad-tv.cabal +++ b/tv/2configs/xserver/xmonad/xmonad.cabal @@ -10,7 +10,6 @@ Executable xmonad base, containers, filepath, - scanner, X11, X11-xshape, xmonad, diff --git a/tv/2configs/xserver/xserver.conf.nix b/tv/2configs/xserver/xserver.conf.nix new file mode 100644 index 0000000..e8a997a --- /dev/null +++ b/tv/2configs/xserver/xserver.conf.nix @@ -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 + ''; +} |