diff options
Diffstat (limited to 'tv/2configs/xserver')
-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 |
11 files changed, 166 insertions, 2 deletions
diff --git a/tv/2configs/xserver/default.nix b/tv/2configs/xserver/default.nix new file mode 100644 index 000000000..b590fbd64 --- /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 f0cb8e08d..000000000 --- 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 a298d72e7..a298d72e7 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 b4772e582..b4772e582 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 5352cf5ad..5352cf5ad 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 b8168b5b0..b8168b5b0 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 5f43cb28a..5f43cb28a 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 b09b97cc2..b09b97cc2 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 de1d8247c..de1d8247c 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 72494abe1..00acf1704 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 000000000..e8a997a99 --- /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 + ''; +} |