diff options
Diffstat (limited to 'lass/5pkgs')
-rw-r--r-- | lass/5pkgs/deploy/default.nix | 2 | ||||
-rw-r--r-- | lass/5pkgs/q/default.nix | 6 | ||||
-rw-r--r-- | lass/5pkgs/super-vnc/default.nix | 38 |
3 files changed, 42 insertions, 4 deletions
diff --git a/lass/5pkgs/deploy/default.nix b/lass/5pkgs/deploy/default.nix index c07cf20d1..a3fe4dca3 100644 --- a/lass/5pkgs/deploy/default.nix +++ b/lass/5pkgs/deploy/default.nix @@ -1,6 +1,6 @@ { writers }: writers.writeDashBin "deploy" '' - set -eu + set -xeu export SYSTEM="$1" $(nix-build $HOME/sync/stockholm/lass/krops.nix --no-out-link --argstr name "$SYSTEM" -A deploy) '' diff --git a/lass/5pkgs/q/default.nix b/lass/5pkgs/q/default.nix index ae8a80266..9b834f0c4 100644 --- a/lass/5pkgs/q/default.nix +++ b/lass/5pkgs/q/default.nix @@ -21,18 +21,18 @@ let }''; in '' ${pkgs.coreutils}/bin/paste \ - <(${pkgs.utillinux}/bin/cal -mw \ + <(${pkgs.util-linux}/bin/cal -mw \ $(${pkgs.coreutils}/bin/date +'%m %Y' -d 'last month') \ | ${pad} ) \ - <(${pkgs.utillinux}/bin/cal -mw \ + <(${pkgs.util-linux}/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 \ + <(${pkgs.util-linux}/bin/cal -mw \ $(${pkgs.coreutils}/bin/date +'%m %Y' -d 'next month') \ | ${pad} ) \ diff --git a/lass/5pkgs/super-vnc/default.nix b/lass/5pkgs/super-vnc/default.nix new file mode 100644 index 000000000..ce0e3aaa7 --- /dev/null +++ b/lass/5pkgs/super-vnc/default.nix @@ -0,0 +1,38 @@ +{ pkgs, lib }: let + + quoteChar = c: + if c == "\n" then "'\n'" + else c; + quote = x: if x == "" then "''" else lib.stringAsChars quoteChar x; + +in pkgs.writers.writeDashBin "super-vnc" '' + PATH=${lib.makeBinPath (with pkgs; [ + xorg.xrandr gnugrep coreutils xorg.xorgserver gnused openssh gawk tightvnc + ])} + remote=$1 + res_x=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1) + res_y=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2) + export modeline="$(gtf "$res_x" "$res_y" 60 | sed -n 's/.*Modeline "\([^" ]\+\)" \(.*\)/\1 \2/p')" + export name="$(echo "$modeline" | sed 's/\([^ ]\+\) .*/\1/')" + export vncline="''${res_x}x''${res_y}+0+0" + + if [ -z "$modeline" -o -z "$name" ]; then + echo "Error! modeline=$modeline name=$name" + exit 1 + fi + + echo $modeline + + # TODO user random highport + ssh "$remote" -L 5900:localhost:55900 bash <<EOF +set -x +export DISPLAY=:0 +export output=\$(xrandr | grep disconnected | tail -1 | cut -d' ' -f1) +xrandr --newmode $modeline +xrandr --verbose --addmode "\$output" "$name" +xrandr --output "\$output" --off +xrandr --verbose --output "\$output" --mode "$name" --right-of "\$(xrandr | grep primary | cut -d ' ' -f1)" +EOF + sleep 2 + vncviewer localhost:55900 +'' |