diff options
author | makefu <github@syntax-fehler.de> | 2017-03-08 14:20:38 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2017-03-08 14:20:38 +0100 |
commit | 8ad08b30961ba5515f88e81dc47f7d5013f92970 (patch) | |
tree | 94919cec986021c5c59ff5b222089cc06565b1f8 /tv | |
parent | 3a3a436b49d555c57079f806f33908ac2430099b (diff) | |
parent | 3374fe9566a366451ea59f325ecb1e2da7046322 (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'tv')
-rw-r--r-- | tv/1systems/cd.nix | 4 | ||||
-rw-r--r-- | tv/2configs/default.nix | 1 | ||||
-rw-r--r-- | tv/2configs/htop.nix | 40 | ||||
-rw-r--r-- | tv/2configs/pulse.nix | 3 | ||||
-rw-r--r-- | tv/5pkgs/q/default.nix | 38 |
5 files changed, 75 insertions, 11 deletions
diff --git a/tv/1systems/cd.nix b/tv/1systems/cd.nix index b718d19b8..108006f34 100644 --- a/tv/1systems/cd.nix +++ b/tv/1systems/cd.nix @@ -16,11 +16,11 @@ with import <stockholm/lib>; networking = { interfaces.enp2s1.ip4 = singleton { address = let - addr = "64.137.177.226"; + addr = "45.62.237.203"; in assert config.krebs.build.host.nets.internet.ip4.addr == addr; addr; prefixLength = 24; }; - defaultGateway = "64.137.177.1"; + defaultGateway = "45.62.237.1"; nameservers = ["8.8.8.8"]; }; diff --git a/tv/2configs/default.nix b/tv/2configs/default.nix index 33fb7e492..e170156a4 100644 --- a/tv/2configs/default.nix +++ b/tv/2configs/default.nix @@ -28,6 +28,7 @@ with import <stockholm/lib>; ./audit.nix ./backup.nix ./bash.nix + ./htop.nix ./nginx ./ssh.nix ./sshd.nix diff --git a/tv/2configs/htop.nix b/tv/2configs/htop.nix new file mode 100644 index 000000000..409df2516 --- /dev/null +++ b/tv/2configs/htop.nix @@ -0,0 +1,40 @@ +{ pkgs, ... }: + +with import <stockholm/lib>; + +{ + nixpkgs.config.packageOverrides = super: { + htop = pkgs.concat "htop" [ + super.htop + (pkgs.writeDashBin "htop" '' + export HTOPRC=${pkgs.writeText "htoprc" '' + fields=0 48 17 18 38 39 40 2 46 47 49 1 + sort_key=46 + sort_direction=1 + hide_threads=0 + hide_kernel_threads=1 + hide_userland_threads=0 + shadow_other_users=1 + show_thread_names=1 + show_program_path=1 + highlight_base_name=1 + highlight_megabytes=1 + highlight_threads=1 + tree_view=1 + header_margin=1 + detailed_cpu_time=0 + cpu_count_from_zero=0 + update_process_names=0 + account_guest_in_cpu_meter=1 + color_scheme=0 + delay=15 + left_meters=LeftCPUs2 RightCPUs2 Memory Swap + left_meter_modes=1 1 1 1 + right_meters=Uptime Tasks LoadAverage Battery + right_meter_modes=2 2 2 2 + ''} + exec ${super.htop}/bin/htop "$@" + '') + ]; + }; +} diff --git a/tv/2configs/pulse.nix b/tv/2configs/pulse.nix index 2a3b5cbc1..418551213 100644 --- a/tv/2configs/pulse.nix +++ b/tv/2configs/pulse.nix @@ -76,6 +76,9 @@ in }; }; + # TODO assert that pulse is the only user with "audio" in group/extraGroups + # otherwise the audio device can be hijacked while the pulse service restarts + # (e.g. when mpv is running) and then the service will fail. users = { groups.pulse.gid = config.users.users.pulse.uid; users.pulse = { diff --git a/tv/5pkgs/q/default.nix b/tv/5pkgs/q/default.nix index a3a7cd739..2e7aa5cf2 100644 --- a/tv/5pkgs/q/default.nix +++ b/tv/5pkgs/q/default.nix @@ -1,7 +1,19 @@ { pkgs, ... }: +with import <stockholm/lib>; let q-cal = let - # XXX 23 is the longest line of cal's output + + # Maximum width of cal's output. + calwidth = 23; + + # Number of space characters between two calendars. + hspace = 2; + + # Return number of columns required to print n calenders side by side. + need_width = n: + assert n >= 1; + n * calwidth + (n - 1) * hspace; + pad = ''{ ${pkgs.gnused}/bin/sed ' # rtrim @@ -10,7 +22,7 @@ let # delete last empty line ''${/^$/d} ' \ - | ${pkgs.gawk}/bin/awk '{printf "%-23s\n", $0}' \ + | ${pkgs.gawk}/bin/awk '{printf "%-${toString calwidth}s\n", $0}' \ | ${pkgs.gnused}/bin/sed ' # colorize header 1,2s/.*/[38;5;238;1m&[39;22m/ @@ -20,23 +32,31 @@ let ' }''; in '' + cols=$(${pkgs.ncurses}/bin/tput cols) ${pkgs.coreutils}/bin/paste \ - <(${pkgs.utillinux}/bin/cal -mw \ + <(if test $cols -ge ${toString (need_width 3)}; then + ${pkgs.utillinux}/bin/cal -mw \ $(${pkgs.coreutils}/bin/date +'%m %Y' -d 'last month') \ | ${pad} - ) \ - <(${pkgs.utillinux}/bin/cal -mw \ + fi) \ + <(if test $cols -ge ${toString (need_width 1)}; then + ${pkgs.utillinux}/bin/cal -mw \ | ${pkgs.gnused}/bin/sed ' # colorize day of month s/\(^\| \)'"$(${pkgs.coreutils}/bin/date +%e)"'\>/[31;1m&[39;22m/ ' \ | ${pad} - ) \ - <(${pkgs.utillinux}/bin/cal -mw \ + fi) \ + <(if test $cols -ge ${toString (need_width 2)}; then + ${pkgs.utillinux}/bin/cal -mw \ $(${pkgs.coreutils}/bin/date +'%m %Y' -d 'next month') \ | ${pad} - ) \ - | ${pkgs.gnused}/bin/sed 's/\t/ /g' + fi) \ + | ${pkgs.gnused}/bin/sed ' + s/^\t// + s/\t$// + s/\t/${lpad hspace " " ""}/g + ' ''; q-isodate = '' |