summaryrefslogtreecommitdiffstats
path: root/mv/2configs/xserver
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2015-11-17 19:04:32 +0100
committertv <tv@krebsco.de>2015-11-17 19:04:32 +0100
commitdba0db28d96978d51284512c6b57a48fbfa9f492 (patch)
tree4e883dbffb5325f1f54d10f840961676aff64639 /mv/2configs/xserver
parentebba531273715c1a9c124007b97f3547d16e780f (diff)
mv: init
Diffstat (limited to 'mv/2configs/xserver')
-rw-r--r--mv/2configs/xserver/Xresources.nix215
-rw-r--r--mv/2configs/xserver/default.nix153
-rw-r--r--mv/2configs/xserver/xserver.conf.nix40
3 files changed, 408 insertions, 0 deletions
diff --git a/mv/2configs/xserver/Xresources.nix b/mv/2configs/xserver/Xresources.nix
new file mode 100644
index 000000000..f287bf206
--- /dev/null
+++ b/mv/2configs/xserver/Xresources.nix
@@ -0,0 +1,215 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+pkgs.writeText "Xresources" ''
+ !URxvt*background: #050505
+
+ ! 2013-02-25 \e was reas escape before
+ ! *VT100.Translations: #override\
+ ! :<Btn4Down>: string("\e[5~")\n\
+ ! :<Btn5Down>: string("\e[6~")
+
+ ! XTerm*VT100*Translations: #override \
+ ! Shift<Key>Return: string(" &") string(0x0A) \n\
+ ! Meta<Key>Return: string(" | less") string(0x0A) \n\
+ ! ~Shift<Key>Prior: scroll-back(1,page) \n\
+ ! ~Shift<Key>Next: scroll-forw(1,page) \n\
+ ! Shift<Key>Prior: scroll-back(1) \n\
+ ! Shift<Key>Next: scroll-forw(1) \n\
+ ! <Key>Delete: string(0x1b) string("[2~")
+ ! \n\
+ ! <Key>BackSpace: string(0x7f)
+
+ ! 2013-02-2013-02-25
+ ! ! <M-c>: load bash-completion (if not already)
+ ! URxvt*VT100*Translations: #override\
+ ! Meta<KeyPress>c:\
+ ! string("\eOH# \eOF\n+compl\n\eOA\eOA\eOH\e[3~\e[3~\eOF")\
+ ! string(0x7)\n
+
+ ! do not scroll automatically on output:
+ ! XTerm*scrollTtyOutput: false
+ URxvt*cutchars: "\\`\"'&()*,;<=>?@[]^{|}‘’"
+ ! URxvt*secondaryScreen: false
+
+ ! URxvt*loginShell: true
+
+ URxvt*eightBitInput: false
+ ! *eightBitOutput: 1
+ ! URxvt*decTerminalID: 220
+ ! URxvt*utf8: 1
+ ! URxvt*locale: UTF-8
+ ! XTerm*customization: -color
+ URxvt*SaveLines: 4096
+ URxvt*font: -*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-1
+ URxvt*boldFont: -*-clean-*-*-*-*-*-*-*-*-*-*-iso10646-1
+
+ ! 2013-05-23 if this does not work try
+ ! xset +fp /usr/share/fonts/local/
+ ! xset fp rehash
+ ! URxvt*font: -*-termsynu-edium-*-*-*-12-*-*-*-*-*-iso10646-1
+ ! URxvt*boldFont: -*-termsynu-bold-*-*-*-12-*-*-*-*-*-iso10646-1
+ !
+ !-misc-termsynu-medium-r-normal--12-87-100-100-c-70-iso10646-1
+
+ ! XTerm*font: -misc-fixed-medium-r-normal--13-120-75-75-c-80-iso10646-1
+ URxvt*scrollBar: false
+
+ ! XTerm*font:-nil-profont-medium-r-normal--11-110-72-72-c-60-iso8859-1
+ ! URxvt*boldFont:-nil-profont-medium-r-normal--11-110-72-72-c-60-iso8859-1
+
+ URxvt*background: #050505
+ ! URxvt*background: #041204
+
+ !URxvt.depth: 32
+ !URxvt*background: rgba:0500/0500/0500/cccc
+
+ ! URxvt*background: #080810
+ URxvt*foreground: #d0d7d0
+ ! URxvt*background: black
+ ! URxvt*foreground: white
+ ! URxvt*background: rgb:00/00/40
+ ! URxvt*foreground: rgb:a0/a0/d0
+ ! XTerm*cursorColor: rgb:00/00/60
+ URxvt*cursorColor: #f042b0
+ URxvt*cursorColor2: #f0b000
+ URxvt*cursorBlink: off
+ ! URxvt*cursorUnderline: true
+ ! URxvt*highlightColor: #232323
+ ! URxvt*highlightTextColor: #b0ffb0
+
+ URxvt*.pointerBlank: true
+ URxvt*.pointerBlankDelay: 987654321
+ URxvt*.pointerColor: #f042b0
+ URxvt*.pointerColor2: #050505
+
+ ! URxvt*fading: 50
+ ! URxvt*fadeColor: #0f0f0f
+
+ ! XTerm*colorMode: on
+ ! URxvt*dynamicColors: on
+ ! URxvt*boldColors: off
+
+ URxvt*jumpScroll: true
+
+ ! allow synthetic events for fvwm, so pass window specific keys
+ ! XTerm*allowSendEvents: true
+ URxvt*allowSendEvents: false
+
+ ! better double/tripple clicking in xterms
+ ! Format: csv, [low-]high:value
+ !
+ ! extend character class 48 due they are used in urls
+ ! (see: man xterm; /CHARACTER CLASSES)
+ ! ! % -./ @ & = ?
+ URxvt*charClass: 33:48,37:48,45-47:48,64:48,38:48,61:48,63:48
+ URxvt*cutNewline: False
+ URxvt*cutToBeginningOfLine: False
+
+ ! BLACK for indigo background
+ URxvt*color0: #232342
+
+ ! TODO: man xterm; /ACTIONS
+
+ ! *VT100*colorULMode: on
+ ! XTerm*underLine: on
+ !
+ ! URxvt*color0: black
+ ! URxvt*color1: red3
+ ! URxvt*color2: green3
+ ! URxvt*color3: yellow3
+ ! URxvt*color4: blue2
+ ! URxvt*color5: magenta3
+ ! URxvt*color6: cyan3
+ ! URxvt*color7: gray90
+ ! URxvt*color8: burlywood1
+ ! URxvt*color9: sienna1
+ ! URxvt*color10: PaleVioletRed1
+ ! URxvt*color11: LightSkyBlue
+ ! URxvt*color12: white
+ ! URxvt*color13: white
+ ! URxvt*color14: white
+ ! URxvt*color33: #f0b0f0
+
+
+ ! URxvt*color0: #000000
+ ! URxvt*color1: #c00000
+ ! URxvt*color2: #80c070
+ URxvt*color3: #c07000
+ ! URxvt*color4: #0000c0
+ URxvt*color4: #4040c0
+ ! URxvt*color5: #c000c0
+ ! URxvt*color6: #008080
+ URxvt*color7: #c0c0c0
+
+ URxvt*color8: #707070
+ URxvt*color9: #ff6060
+ URxvt*color10: #70ff70
+ URxvt*color11: #ffff70
+ URxvt*color12: #7070ff
+ URxvt*color13: #ff50ff
+ URxvt*color14: #70ffff
+ URxvt*color15: #ffffff
+
+ ! XTerm*color91: #000070
+ ! XTerm*color92: #000080
+ ! XTerm*color93: #000090
+ ! XTerm*color94: #0000a0
+ ! XTerm*color95: #0000b0
+ ! XTerm*color96: #0000c0
+ ! XTerm*color97: #0000d0
+ ! XTerm*color98: #0000e0
+ ! XTerm*color99: #0000f0
+
+ ! !! vim-create-colorscheme {{{
+ ! !! Question cterm=none
+ ! XTerm*color20: #f0b000
+ ! !! }}}
+ !
+ !
+ ! #include ".xrdb/look-zenburn.xrdb"
+ ! #include ".xrdb/xterm.xrdb"
+
+
+
+ ! URxvt.perl-ext: matcher
+ ! URxvt.urlLauncher: cr
+ ! URxvt.underlineColor: blue
+
+ ! URxvt.matcher.button: 1
+ ! URxvt.perl-ext: default,matcher
+ ! URxvt.urlLauncher: cr
+ ! URxvt.matcher.pattern.1: \\bwww\\.[\\w-]+\\.[\\w./?&@#-]*[\\w/-]
+ ! URxvt.underlineColor: blue
+
+ ! 2014-05-12 von lass
+ !URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select
+ !URxvt.url-select.launcher: /home/tv/bin/ff -new-tab
+ !URxvt.url-select.underline: true
+ !URxvt.keysym.M-u: perl:url-select:select_next
+ !URxvt.keysym.M-Escape: perl:keyboard-select:activate
+ !URxvt.keysym.M-s: perl:keyboard-select:search
+
+
+
+
+ ! 2013-02-25 I neve use this
+ URxvt*iso14755: False
+
+ URxvt*urgentOnBell: True
+ URxvt*visualBell: True
+
+ ! ref https://github.com/muennich/urxvt-perls
+ URxvt*perl-ext: default,url-select
+ URxvt*keysym.M-u: perl:url-select:select_next
+ URxvt*url-select.launcher: ${pkgs.ff}/bin/ff -new-tab
+ URxvt*url-select.underline: true
+ URxvt*colorUL: #4682B4
+ URxvt.perl-lib: ${pkgs.urxvt_perls}/lib/urxvt/perl
+
+ root-urxvt*background: #230000
+ root-urxvt*foreground: #e0c0c0
+ root-urxvt*BorderColor: #400000
+ root-urxvt*color0: #800000
+''
diff --git a/mv/2configs/xserver/default.nix b/mv/2configs/xserver/default.nix
new file mode 100644
index 000000000..afc2d699c
--- /dev/null
+++ b/mv/2configs/xserver/default.nix
@@ -0,0 +1,153 @@
+{ 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.ff
+ pkgs.gitAndTools.qgit
+ pkgs.mpv
+ pkgs.pavucontrol
+ pkgs.slock
+ pkgs.sxiv
+ pkgs.xsel
+ pkgs.zathura
+ ];
+
+ security.setuidPrograms = [
+ "slock"
+ ];
+
+ systemd.services.display-manager = mkForce {};
+
+ services.xserver.enable = true;
+
+ systemd.services.xmonad = {
+ wantedBy = [ "multi-user.target" ];
+ requires = [ "xserver.service" ];
+ environment = xmonad-environment;
+ serviceConfig = {
+ ExecStart = "${xmonad-start}/bin/xmonad";
+ ExecStop = "${xmonad-stop}/bin/xmonad-stop";
+ 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-environment = {
+ DISPLAY = ":${toString config.services.xserver.display}";
+ XMONAD_STATE = "/tmp/xmonad.state";
+
+ # XXX JSON is close enough :)
+ XMONAD_WORKSPACES0_FILE = pkgs.writeText "xmonad.workspaces0" (toJSON [
+ "Dashboard" # we start here
+ "23"
+ "cr"
+ "ff"
+ "hack"
+ "im"
+ "mail"
+ "stockholm"
+ "za" "zh" "zj" "zs"
+ ]);
+ };
+
+ xmonad-start = pkgs.writeScriptBin "xmonad" ''
+ #! ${pkgs.bash}/bin/bash
+ set -efu
+ export PATH; PATH=${makeSearchPath "bin" [
+ 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.
+ 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/mv/2configs/xserver/xserver.conf.nix b/mv/2configs/xserver/xserver.conf.nix
new file mode 100644
index 000000000..e8a997a99
--- /dev/null
+++ b/mv/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
+ '';
+}