diff options
author | lassulus <lass@aidsballs.de> | 2015-10-31 00:13:32 +0100 |
---|---|---|
committer | lassulus <lass@aidsballs.de> | 2015-10-31 00:13:32 +0100 |
commit | 5b4a34062462311973bb1798fe3e4538e6eb5706 (patch) | |
tree | 31ac952feeb3f534b57fc48c6ae2f71795be2f43 | |
parent | 611f8ef25b4c3984f2f7de7362c4869d1f2f124f (diff) | |
parent | bcaf3771d9503f1b0d01a2c15ca0712ee454342f (diff) |
Merge remote-tracking branch 'cd/master'
-rw-r--r-- | tv/1systems/cd.nix | 4 | ||||
-rw-r--r-- | tv/1systems/mkdir.nix | 4 | ||||
-rw-r--r-- | tv/1systems/nomic.nix | 9 | ||||
-rw-r--r-- | tv/1systems/rmdir.nix | 4 | ||||
-rw-r--r-- | tv/1systems/wu.nix | 4 | ||||
-rw-r--r-- | tv/1systems/xu.nix | 390 | ||||
-rw-r--r-- | tv/2configs/CAC-CentOS-7-64bit.nix | 47 | ||||
-rw-r--r-- | tv/2configs/CAC-Developer-1.nix | 6 | ||||
-rw-r--r-- | tv/2configs/CAC-Developer-2.nix | 6 | ||||
-rw-r--r-- | tv/2configs/cryptoroot.nix | 4 | ||||
-rw-r--r-- | tv/2configs/fs/CAC-CentOS-7-64bit.nix | 20 | ||||
-rw-r--r-- | tv/2configs/hw/AO753.nix (renamed from tv/2configs/AO753.nix) | 9 | ||||
-rw-r--r-- | tv/2configs/hw/CAC-Developer-1.nix | 8 | ||||
-rw-r--r-- | tv/2configs/hw/CAC-Developer-2.nix | 8 | ||||
-rw-r--r-- | tv/2configs/hw/CAC.nix | 13 | ||||
-rw-r--r-- | tv/2configs/hw/w110er.nix (renamed from tv/2configs/w110er.nix) | 6 | ||||
-rw-r--r-- | tv/2configs/hw/x220.nix | 60 | ||||
-rw-r--r-- | tv/2configs/xserver/default.nix | 22 | ||||
-rw-r--r-- | tv/2configs/xserver/xmonad/Util/Debunk.hs | 16 | ||||
-rw-r--r-- | tv/5pkgs/default.nix | 3 | ||||
-rw-r--r-- | tv/5pkgs/xmonad-tv/.gitignore (renamed from tv/2configs/xserver/xmonad/.gitignore) | 0 | ||||
-rw-r--r-- | tv/5pkgs/xmonad-tv/Main.hs (renamed from tv/2configs/xserver/xmonad/Main.hs) | 30 | ||||
-rw-r--r-- | tv/5pkgs/xmonad-tv/Makefile | 6 | ||||
-rw-r--r-- | tv/5pkgs/xmonad-tv/Util/Font.hs (renamed from tv/2configs/xserver/xmonad/Util/Font.hs) | 0 | ||||
-rw-r--r-- | tv/5pkgs/xmonad-tv/Util/Pager.hs (renamed from tv/2configs/xserver/xmonad/Util/Pager.hs) | 0 | ||||
-rw-r--r-- | tv/5pkgs/xmonad-tv/Util/Rhombus.hs (renamed from tv/2configs/xserver/xmonad/Util/Rhombus.hs) | 1 | ||||
-rw-r--r-- | tv/5pkgs/xmonad-tv/Util/Shutdown.hs (renamed from tv/2configs/xserver/xmonad/Util/Shutdown.hs) | 2 | ||||
-rw-r--r-- | tv/5pkgs/xmonad-tv/Util/Submap.hs (renamed from tv/2configs/xserver/xmonad/Util/Submap.hs) | 0 | ||||
-rw-r--r-- | tv/5pkgs/xmonad-tv/Util/XUtils.hs (renamed from tv/2configs/xserver/xmonad/Util/XUtils.hs) | 0 | ||||
-rw-r--r-- | tv/5pkgs/xmonad-tv/xmonad.cabal (renamed from tv/2configs/xserver/xmonad/xmonad.cabal) | 1 |
30 files changed, 565 insertions, 118 deletions
diff --git a/tv/1systems/cd.nix b/tv/1systems/cd.nix index d2b08bef7..69f1300be 100644 --- a/tv/1systems/cd.nix +++ b/tv/1systems/cd.nix @@ -24,8 +24,8 @@ with lib; }; imports = [ - ../2configs/CAC-Developer-2.nix - ../2configs/CAC-CentOS-7-64bit.nix + ../2configs/hw/CAC-Developer-2.nix + ../2configs/fs/CAC-CentOS-7-64bit.nix ../2configs/base.nix #../2configs/consul-server.nix ../2configs/exim-smarthost.nix diff --git a/tv/1systems/mkdir.nix b/tv/1systems/mkdir.nix index f0c7dc2a0..305ea7269 100644 --- a/tv/1systems/mkdir.nix +++ b/tv/1systems/mkdir.nix @@ -37,8 +37,8 @@ in }; imports = [ - ../2configs/CAC-Developer-1.nix - ../2configs/CAC-CentOS-7-64bit.nix + ../2configs/hw/CAC-Developer-1.nix + ../2configs/fs/CAC-CentOS-7-64bit.nix ../2configs/base.nix ../2configs/consul-server.nix ../2configs/exim-smarthost.nix diff --git a/tv/1systems/nomic.nix b/tv/1systems/nomic.nix index 210846215..61f833d41 100644 --- a/tv/1systems/nomic.nix +++ b/tv/1systems/nomic.nix @@ -24,7 +24,7 @@ with lib; }; imports = [ - ../2configs/AO753.nix + ../2configs/hw/AO753.nix ../2configs/base.nix #../2configs/consul-server.nix ../2configs/git.nix @@ -87,13 +87,6 @@ with lib; swapDevices = [ ]; - nix = { - buildCores = 2; - maxJobs = 2; - daemonIONiceLevel = 1; - daemonNiceLevel = 1; - }; - # TODO base boot.tmpOnTmpfs = true; diff --git a/tv/1systems/rmdir.nix b/tv/1systems/rmdir.nix index c52222cd1..f77268b53 100644 --- a/tv/1systems/rmdir.nix +++ b/tv/1systems/rmdir.nix @@ -37,8 +37,8 @@ in }; imports = [ - ../2configs/CAC-Developer-1.nix - ../2configs/CAC-CentOS-7-64bit.nix + ../2configs/hw/CAC-Developer-1.nix + ../2configs/fs/CAC-CentOS-7-64bit.nix ../2configs/base.nix ../2configs/consul-server.nix ../2configs/exim-smarthost.nix diff --git a/tv/1systems/wu.nix b/tv/1systems/wu.nix index 586ad1725..65389b662 100644 --- a/tv/1systems/wu.nix +++ b/tv/1systems/wu.nix @@ -24,7 +24,7 @@ with lib; }; imports = [ - ../2configs/w110er.nix + ../2configs/hw/w110er.nix ../2configs/base.nix #../2configs/consul-client.nix ../2configs/git.nix @@ -389,6 +389,4 @@ with lib; services.tor.enable = true; services.virtualboxHost.enable = true; - # TODO w110er if xserver is enabled - services.xserver.vaapiDrivers = [ pkgs.vaapiIntel ]; } diff --git a/tv/1systems/xu.nix b/tv/1systems/xu.nix new file mode 100644 index 000000000..82f5abf73 --- /dev/null +++ b/tv/1systems/xu.nix @@ -0,0 +1,390 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + krebs.build.host = config.krebs.hosts.xu; + krebs.build.user = config.krebs.users.tv; + + krebs.build.target = "root@xu"; + + krebs.build.source = { + git.nixpkgs = { + url = https://github.com/NixOS/nixpkgs; + rev = "e57024f821c94caf5684964474073649b8b6356b"; + }; + dir.secrets = { + host = config.krebs.hosts.wu; + path = "/home/tv/secrets/xu"; + }; + dir.stockholm = { + host = config.krebs.hosts.wu; + path = "/home/tv/stockholm"; + }; + }; + + imports = [ + ../2configs/hw/x220.nix + ../2configs/base.nix + #../2configs/consul-client.nix + ../2configs/git.nix + ../2configs/mail-client.nix + ../2configs/xserver + { + environment.systemPackages = with pkgs; [ + + # stockholm + genid + gnumake + hashPassword + lentil + parallel + (pkgs.writeScriptBin "im" '' + #! ${pkgs.bash}/bin/bash + export PATH=${makeSearchPath "bin" (with pkgs; [ + tmux + gnugrep + weechat + ])} + if tmux list-sessions -F\#S | grep -q '^im''$'; then + exec tmux attach -t im + else + exec tmux new -s im weechat + fi + '') + + # root + cryptsetup + ntp # ntpate + + # tv + bc + bind # dig + #cac + dic + ff + file + gitAndTools.qgit #xserver + gnupg21 + haskellPackages.hledger + htop + jq + manpages + mkpasswd + mpv #xserver + netcat + nix-repl + nmap + nq + p7zip + pavucontrol #xserver + posix_man_pages + #pssh + qrencode + sxiv #xserver + texLive + tmux + zathura #xserver + + #ack + #apache-httpd + #ascii + #emacs + #es + #esniper + #gcc + #gptfdisk + #graphviz + #haskellPackages.cabal2nix + #haskellPackages.ghc + #haskellPackages.shake + #hdparm + #i7z + #iftop + #imagemagick + #inotifyTools + #iodine + #iotop + #lshw + #lsof + #minicom + #mtools + #ncmpc + #neovim + #nethogs + #nix-prefetch-scripts #cvs bug + #openssl + #openswan + #parted + #perl + #powertop + #ppp + #proot + #pythonPackages.arandr + #pythonPackages.youtube-dl + #racket + #rxvt_unicode-with-plugins + #scrot + #sec + #silver-searcher + #sloccount + #smartmontools + #socat + #sshpass + #strongswan + #sysdig + #sysstat + #tcpdump + #tlsdate + #unetbootin + #utillinuxCurses + #wvdial + #xdotool + #xkill + #xl2tpd + #xsel + ]; + } + { + tv.iptables = { + enable = true; + input-internet-accept-new-tcp = [ + "ssh" + "http" + "tinc" + "smtp" + ]; + }; + } + { + krebs.exim-retiolum.enable = true; + } + { + krebs.nginx = { + enable = true; + servers.default.locations = [ + (nameValuePair "~ ^/~(.+?)(/.*)?\$" '' + alias /home/$1/public_html$2; + '') + ]; + }; + } + { + krebs.retiolum = { + enable = true; + connectTo = [ + "cd" + "gum" + "pigstarter" + ]; + }; + } + { + users.extraGroups = { + tv.gid = 1337; + slaves.gid = 3799582008; # genid slaves + }; + + users.extraUsers = + mapAttrs (name: user@{ extraGroups ? [], ... }: user // { + inherit name; + home = "/home/${name}"; + createHome = true; + useDefaultShell = true; + group = "tv"; + extraGroups = ["slaves"] ++ extraGroups; + }) { + ff = { + uid = 13378001; + extraGroups = [ + "audio" + "video" + ]; + }; + + cr = { + uid = 13378002; + extraGroups = [ + "audio" + "video" + "bumblebee" + ]; + }; + + fa = { + uid = 2300001; + }; + + rl = { + uid = 2300002; + }; + + tief = { + uid = 2300702; + }; + + btc-bitcoind = { + uid = 2301001; + }; + + btc-electrum = { + uid = 2301002; + }; + + ltc-litecoind = { + uid = 2301101; + }; + + eth = { + uid = 2302001; + }; + + emse-hsdb = { + uid = 4200101; + }; + + wine = { + uid = 13370400; + extraGroups = [ + "audio" + "video" + "bumblebee" + ]; + }; + + df = { + uid = 13370401; + extraGroups = [ + "audio" + "video" + "bumblebee" + ]; + }; + + xr = { + uid = 13370061; + extraGroups = [ + "audio" + "video" + ]; + }; + + "23" = { + uid = 13370023; + }; + + electrum = { + uid = 13370102; + }; + + skype = { + uid = 6660001; + extraGroups = [ + "audio" + ]; + }; + + onion = { + uid = 6660010; + }; + + zalora = { + uid = 1000301; + extraGroups = [ + "audio" + # TODO remove vboxusers when hardening is active + "vboxusers" + "video" + ]; + }; + }; + + security.sudo.extraConfig = + let + isSlave = u: elem "slaves" u.extraGroups; + masterOf = u: u.group; + slaves = filterAttrs (_: isSlave) config.users.extraUsers; + toSudoers = u: "${masterOf u} ALL=(${u.name}) NOPASSWD: ALL"; + in + concatMapStringsSep "\n" toSudoers (attrValues slaves); + } + ]; + + boot.initrd.luks = { + cryptoModules = [ "aes" "sha512" "xts" ]; + devices = [ + { name = "xuca"; device = "/dev/sda2"; } + ]; + }; + + fileSystems = { + "/" = { + device = "/dev/mapper/xuvga-root"; + fsType = "btrfs"; + options = "defaults,noatime,ssd,compress=lzo"; + }; + "/home" = { + device = "/dev/mapper/xuvga-home"; + fsType = "btrfs"; + options = "defaults,noatime,ssd,compress=lzo"; + }; + "/boot" = { + device = "/dev/sda1"; + }; + "/tmp" = { + device = "tmpfs"; + fsType = "tmpfs"; + options = "nosuid,nodev,noatime"; + }; + }; + + nixpkgs.config.chromium.enablePepperFlash = true; + + nixpkgs.config.allowUnfree = true; + #hardware.bumblebee.enable = true; + #hardware.bumblebee.group = "video"; + hardware.enableAllFirmware = true; + #hardware.opengl.driSupport32Bit = true; + hardware.pulseaudio.enable = true; + + environment.systemPackages = with pkgs; [ + #xlibs.fontschumachermisc + #slock + ethtool + #firefoxWrapper # with plugins + #chromiumDevWrapper + tinc + iptables + #jack2 + + gptfdisk + ]; + + security.setuidPrograms = [ + "sendmail" # for cron + #"slock" + ]; + + services.printing.enable = true; + + services.journald.extraConfig = '' + SystemMaxUse=1G + RuntimeMaxUse=128M + ''; + + # see tmpfiles.d(5) + systemd.tmpfiles.rules = [ + "d /tmp 1777 root root - -" # does this work with mounted /tmp? + ]; + + #virtualisation.libvirtd.enable = true; + + #services.bitlbee.enable = true; + #services.tor.client.enable = true; + #services.tor.enable = true; + #services.virtualboxHost.enable = true; + + + # The NixOS release to be compatible with for stateful data such as databases. + system.stateVersion = "15.09"; +} diff --git a/tv/2configs/CAC-CentOS-7-64bit.nix b/tv/2configs/CAC-CentOS-7-64bit.nix deleted file mode 100644 index 168d1d97b..000000000 --- a/tv/2configs/CAC-CentOS-7-64bit.nix +++ /dev/null @@ -1,47 +0,0 @@ -_: - -{ - boot.loader.grub = { - device = "/dev/sda"; - splashImage = null; - }; - - boot.initrd.availableKernelModules = [ - "ata_piix" - "vmw_pvscsi" - ]; - - fileSystems."/" = { - device = "/dev/centos/root"; - fsType = "xfs"; - }; - - fileSystems."/boot" = { - device = "/dev/sda1"; - fsType = "xfs"; - }; - - swapDevices = [ - { device = "/dev/centos/swap"; } - ]; - - users.extraGroups = { - # ● systemd-tmpfiles-setup.service - Create Volatile Files and Directories - # Loaded: loaded (/nix/store/2l33gg7nmncqkpysq9f5fxyhlw6ncm2j-systemd-217/example/systemd/system/systemd-tmpfiles-setup.service) - # Active: failed (Result: exit-code) since Mon 2015-03-16 10:29:18 UTC; 4s ago - # Docs: man:tmpfiles.d(5) - # man:systemd-tmpfiles(8) - # Process: 19272 ExecStart=/nix/store/2l33gg7nmncqkpysq9f5fxyhlw6ncm2j-systemd-217/bin/systemd-tmpfiles --create --remove --boot --exclude-prefix=/dev (code=exited, status=1/FAILURE) - # Main PID: 19272 (code=exited, status=1/FAILURE) - # - # Mar 16 10:29:17 cd systemd-tmpfiles[19272]: [/usr/lib/tmpfiles.d/legacy.conf:26] Unknown group 'lock'. - # Mar 16 10:29:18 cd systemd-tmpfiles[19272]: Two or more conflicting lines for /var/log/journal configured, ignoring. - # Mar 16 10:29:18 cd systemd-tmpfiles[19272]: Two or more conflicting lines for /var/log/journal/7b35116927d74ea58785e00b47ac0f0d configured, ignoring. - # Mar 16 10:29:18 cd systemd[1]: systemd-tmpfiles-setup.service: main process exited, code=exited, status=1/FAILURE - # Mar 16 10:29:18 cd systemd[1]: Failed to start Create Volatile Files and Directories. - # Mar 16 10:29:18 cd systemd[1]: Unit systemd-tmpfiles-setup.service entered failed state. - # Mar 16 10:29:18 cd systemd[1]: systemd-tmpfiles-setup.service failed. - # warning: error(s) occured while switching to the new configuration - lock.gid = 10001; - }; -} diff --git a/tv/2configs/CAC-Developer-1.nix b/tv/2configs/CAC-Developer-1.nix deleted file mode 100644 index 37bc32afb..000000000 --- a/tv/2configs/CAC-Developer-1.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: - -{ - nix.maxJobs = 1; - sound.enable = false; -} diff --git a/tv/2configs/CAC-Developer-2.nix b/tv/2configs/CAC-Developer-2.nix deleted file mode 100644 index fedb808df..000000000 --- a/tv/2configs/CAC-Developer-2.nix +++ /dev/null @@ -1,6 +0,0 @@ -_: - -{ - nix.maxJobs = 2; - sound.enable = false; -} diff --git a/tv/2configs/cryptoroot.nix b/tv/2configs/cryptoroot.nix deleted file mode 100644 index 04618ac4a..000000000 --- a/tv/2configs/cryptoroot.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ ... }: - -{ -} diff --git a/tv/2configs/fs/CAC-CentOS-7-64bit.nix b/tv/2configs/fs/CAC-CentOS-7-64bit.nix new file mode 100644 index 000000000..c9eb97f44 --- /dev/null +++ b/tv/2configs/fs/CAC-CentOS-7-64bit.nix @@ -0,0 +1,20 @@ +_: + +{ + boot.loader.grub = { + device = "/dev/sda"; + }; + fileSystems = { + "/" = { + device = "/dev/centos/root"; + fsType = "xfs"; + }; + "/boot" = { + device = "/dev/sda1"; + fsType = "xfs"; + }; + }; + swapDevices = [ + { device = "/dev/centos/swap"; } + ]; +} diff --git a/tv/2configs/AO753.nix b/tv/2configs/hw/AO753.nix index 96167ce01..acd9ee32b 100644 --- a/tv/2configs/AO753.nix +++ b/tv/2configs/hw/AO753.nix @@ -2,7 +2,7 @@ { imports = [ - ../2configs/smartd.nix + ../smartd.nix ]; boot.loader.grub = { @@ -25,6 +25,13 @@ networking.wireless.enable = true; + nix = { + buildCores = 2; + maxJobs = 2; + daemonIONiceLevel = 1; + daemonNiceLevel = 1; + }; + services.logind.extraConfig = '' HandleHibernateKey=ignore HandleLidSwitch=ignore diff --git a/tv/2configs/hw/CAC-Developer-1.nix b/tv/2configs/hw/CAC-Developer-1.nix new file mode 100644 index 000000000..5143c8359 --- /dev/null +++ b/tv/2configs/hw/CAC-Developer-1.nix @@ -0,0 +1,8 @@ +_: +{ + imports = [ ./CAC.nix ]; + nix = { + buildCores = 1; + maxJobs = 1; + }; +} diff --git a/tv/2configs/hw/CAC-Developer-2.nix b/tv/2configs/hw/CAC-Developer-2.nix new file mode 100644 index 000000000..1b3b102cc --- /dev/null +++ b/tv/2configs/hw/CAC-Developer-2.nix @@ -0,0 +1,8 @@ +_: +{ + imports = [ ./CAC.nix ]; + nix = { + buildCores = 2; + maxJobs = 2; + }; +} diff --git a/tv/2configs/hw/CAC.nix b/tv/2configs/hw/CAC.nix new file mode 100644 index 000000000..9ed18344a --- /dev/null +++ b/tv/2configs/hw/CAC.nix @@ -0,0 +1,13 @@ +_: +{ + boot.initrd.availableKernelModules = [ + "ata_piix" + "vmw_pvscsi" + ]; + boot.loader.grub.splashImage = null; + nix = { + daemonIONiceLevel = 1; + daemonNiceLevel = 1; + }; + sound.enable = false; +} diff --git a/tv/2configs/w110er.nix b/tv/2configs/hw/w110er.nix index e580b2161..aa8292441 100644 --- a/tv/2configs/w110er.nix +++ b/tv/2configs/hw/w110er.nix @@ -2,7 +2,7 @@ { imports = [ - ../2configs/smartd.nix + ../smartd.nix ]; boot.extraModprobeConfig = '' @@ -31,6 +31,10 @@ HandleSuspendKey=ignore ''; + services.xserver = { + vaapiDrivers = [ pkgs.vaapiIntel ]; + }; + system.activationScripts.powertopTunables = '' echo 1 > /sys/module/snd_hda_intel/parameters/power_save echo 1500 > /proc/sys/vm/dirty_writeback_centisecs diff --git a/tv/2configs/hw/x220.nix b/tv/2configs/hw/x220.nix new file mode 100644 index 000000000..8549311e7 --- /dev/null +++ b/tv/2configs/hw/x220.nix @@ -0,0 +1,60 @@ +{ pkgs, ... }: + +{ + imports = [ + ../smartd.nix + ]; + + boot.initrd.availableKernelModules = [ "ahci" ]; + boot.kernelModules = [ "kvm-intel" ]; + + boot.loader.gummiboot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.wireless.enable = true; + + #hardware.enableAllFirmware = true; + #nixpkgs.config.allowUnfree = true; + #zramSwap.enable = true; + #zramSwap.numDevices = 2; + + hardware.trackpoint = { + enable = true; + sensitivity = 220; + speed = 0; + emulateWheel = true; + }; + + services.tlp.enable = true; + services.tlp.extraConfig = '' + START_CHARGE_THRESH_BAT0=80 + ''; + + nix = { + buildCores = 2; + maxJobs = 2; + daemonIONiceLevel = 1; + daemonNiceLevel = 1; + }; + + services.logind.extraConfig = '' + HandleHibernateKey=ignore + HandleLidSwitch=ignore + HandlePowerKey=ignore + HandleSuspendKey=ignore + ''; + + services.xserver = { + videoDriver = "intel"; + vaapiDrivers = [ pkgs.vaapiIntel pkgs.vaapiVdpau ]; + deviceSection = '' + Option "AccelMethod" "sna" + ''; + }; + + #services.xserver.displayManager.sessionCommands ='' + # xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation" 8 1 + # xinput set-int-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Button" 8 2 + # xinput set-prop "TPPS/2 IBM TrackPoint" "Evdev Wheel Emulation Axes" 6 7 4 5 + #''; +} diff --git a/tv/2configs/xserver/default.nix b/tv/2configs/xserver/default.nix index c5cffbb30..4d2fe9e45 100644 --- a/tv/2configs/xserver/default.nix +++ b/tv/2configs/xserver/default.nix @@ -70,10 +70,15 @@ let ExecStart = "${xserver}/bin/xserver"; }; }; - }; - xmonad-pkg = pkgs.haskellPackages.callPackage xmonad-src {}; - xmonad-src = pkgs.writeNixFromCabal "xmonad.nix" ./xmonad; + programs.bash.interactiveShellInit = '' + case ''${XMONAD_SPAWN_WORKSPACE-} in + za|zh|zj|zs) + exec sudo -u zalora -i + ;; + esac + ''; + }; xmonad-environment = { DISPLAY = ":${toString config.services.xserver.display}"; @@ -89,7 +94,7 @@ let "im" "mail" "stockholm" - "za" "zj" "zs" + "za" "zh" "zj" "zs" ]); }; @@ -111,17 +116,12 @@ let 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' - if test -e "$XMONAD_STATE"; then - IFS=''$'\n' - exec ${xmonad-pkg}/bin/xmonad --resume $(< "$XMONAD_STATE") - else - exec ${xmonad-pkg}/bin/xmonad - fi + exec ${pkgs.xmonad-tv}/bin/xmonad ''; xmonad-stop = pkgs.writeScriptBin "xmonad-stop" '' #! /bin/sh - exec ${xmonad-pkg}/bin/xmonad --shutdown + exec ${pkgs.xmonad-tv}/bin/xmonad --shutdown ''; xserver-environment = { diff --git a/tv/2configs/xserver/xmonad/Util/Debunk.hs b/tv/2configs/xserver/xmonad/Util/Debunk.hs deleted file mode 100644 index b4772e582..000000000 --- a/tv/2configs/xserver/xmonad/Util/Debunk.hs +++ /dev/null @@ -1,16 +0,0 @@ -module Util.Debunk - ( printToErrors - ) where - -import XMonad -import System.FilePath ( (</>) ) -import Control.Exception ( bracket ) -import System.IO ( hPrint, stderr, openFile, hClose, IOMode( AppendMode ) ) - - -printToErrors x = do - dir <- getXMonadDir - let base = dir </> "xmonad" - err = base ++ ".errors" - bracket (openFile err AppendMode) hClose $ \h -> hPrint h x - diff --git a/tv/5pkgs/default.nix b/tv/5pkgs/default.nix index 3cfa8f863..1ca5e70a2 100644 --- a/tv/5pkgs/default.nix +++ b/tv/5pkgs/default.nix @@ -3,4 +3,7 @@ { ff = pkgs.callPackage ./ff {}; viljetic-pages = pkgs.callPackage ./viljetic-pages {}; + xmonad-tv = + let src = pkgs.writeNixFromCabal "xmonad-tv.nix" ./xmonad-tv; in + pkgs.haskellPackages.callPackage src {}; } diff --git a/tv/2configs/xserver/xmonad/.gitignore b/tv/5pkgs/xmonad-tv/.gitignore index 616204547..616204547 100644 --- a/tv/2configs/xserver/xmonad/.gitignore +++ b/tv/5pkgs/xmonad-tv/.gitignore diff --git a/tv/2configs/xserver/xmonad/Main.hs b/tv/5pkgs/xmonad-tv/Main.hs index 186a5e22c..2cc48efa3 100644 --- a/tv/2configs/xserver/xmonad/Main.hs +++ b/tv/5pkgs/xmonad-tv/Main.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DeriveDataTypeable #-} -- for XS +{-# LANGUAGE FlexibleContexts #-} -- for xmonad' {-# LANGUAGE LambdaCase #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -8,7 +9,9 @@ module Main where import Control.Exception import Text.Read (readEither) import XMonad -import System.Environment (getArgs, getEnv) +import System.IO (hPutStrLn, stderr) +import System.Environment (getArgs, withArgs, getEnv, getEnvironment) +import System.Posix.Process (executeFile) import XMonad.Prompt (defaultXPConfig) import XMonad.Actions.DynamicWorkspaces ( addWorkspacePrompt, renameWorkspace , removeEmptyWorkspace) @@ -34,7 +37,6 @@ import XMonad.Layout.PerWorkspace (onWorkspace) --import XMonad.Actions.Submap import Util.Pager import Util.Rhombus -import Util.Debunk import Util.Shutdown @@ -55,7 +57,7 @@ main = getArgs >>= \case mainNoArgs :: IO () mainNoArgs = do workspaces0 <- getWorkspaces0 - xmonad + xmonad' -- $ withUrgencyHookC dzenUrgencyHook { args = ["-bg", "magenta", "-fg", "magenta", "-h", "2"], duration = 500000 } -- urgencyConfig { remindWhen = Every 1 } -- $ withUrgencyHook borderUrgencyHook "magenta" @@ -81,6 +83,17 @@ mainNoArgs = do (FixedColumn 1 20 80 10 ||| Full) +xmonad' :: (LayoutClass l Window, Read (l Window)) => XConfig l -> IO () +xmonad' conf = do + path <- getEnv "XMONAD_STATE" + try (readFile path) >>= \case + Right content -> do + hPutStrLn stderr ("resuming from " ++ path) + withArgs ("--resume" : lines content) (xmonad conf) + Left e -> do + hPutStrLn stderr (displaySomeException e) + xmonad conf + getWorkspaces0 :: IO [String] getWorkspaces0 = try (getEnv "XMONAD_WORKSPACES0_FILE") >>= \case @@ -91,7 +104,7 @@ getWorkspaces0 = Left e -> warn e |