From 29962e5e7457a90e5b952f85423d35aa40885683 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Sun, 11 Feb 2024 17:29:31 -0700 Subject: [PATCH] bins/tstart: remove infavor of smug --- bins/default.nix | 3 -- bins/tstart.nix | 41 --------------------- configs/default.nix | 1 + configs/smug.nix | 87 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+), 44 deletions(-) delete mode 100644 bins/tstart.nix create mode 100644 configs/smug.nix diff --git a/bins/default.nix b/bins/default.nix index dfea9e2..7163b35 100644 --- a/bins/default.nix +++ b/bins/default.nix @@ -13,8 +13,6 @@ let xinStatus = pkgs.writeScriptBin "xin-status" (import ./xin-status.nix { inherit (pkgs) perl perlPackages; }); - tstart = - pkgs.writeScriptBin "tstart" (import ./tstart.nix { inherit (pkgs) tmux; }); sfetch = pkgs.writeScriptBin "sfetch" (import ./sfetch.nix { inherit gosignify; inherit (pkgs) curl; @@ -31,7 +29,6 @@ in genPatches ix sfetch - tstart xclip xinStatus ] ++ (if config.services.postgresql.enable then diff --git a/bins/tstart.nix b/bins/tstart.nix deleted file mode 100644 index 44c6f7f..0000000 --- a/bins/tstart.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ tmux }: -let - tmuxBin = "${tmux}/bin/tmux"; -in -'' - #!/usr/bin/env sh - - set -e - - SNAME="Main" - SSES="-s $SNAME" - IDX=1 - - if ${tmuxBin} ls | grep -q "^''${SNAME}:"; then - ${tmuxBin} -u2 at -t "$SNAME" - else - ${tmuxBin} -2 new-session -d $SSES - if [ -e ~/.tmux.windows ]; then - count=$IDX - for n in $(cat ~/.tmux.windows); do - if [ $n == "_" ]; then - ${tmuxBin} new-window - else - if [ $count -eq $IDX ]; then - ${tmuxBin} rename-window "$n" - else - ${tmuxBin} new-window -n "$n" - fi - fi - ((count=count+1)) - done - else - ${tmuxBin} rename-window "IRC" - ${tmuxBin} new-window -n "Mail" - ${tmuxBin} new-window -n "Misc" - ${tmuxBin} new-window - fi - ${tmuxBin} select-window -t$IDX - ${tmuxBin} -2 attach-session -t $SNAME - fi -'' diff --git a/configs/default.nix b/configs/default.nix index 94ac843..ef8945f 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -3,6 +3,7 @@ ./alacritty.nix ./ca.nix ./ci.nix + ./smug.nix ./colemak.nix ./dns.nix ./doas.nix diff --git a/configs/smug.nix b/configs/smug.nix new file mode 100644 index 0000000..6c61e0c --- /dev/null +++ b/configs/smug.nix @@ -0,0 +1,87 @@ +{ config +, pkgs +, ... +}: +let + tmuxFormat = pkgs.formats.yaml { }; +in +{ + config = { + programs.zsh.promptInit = '' + alias tstart='smug -f /etc/smug/main.yml start'; + alias cistart='smug -f /etc/smug/ci.yml start'; + ''; + environment = { + systemPackages = with pkgs; [ + smug + ]; + etc."smug/ci.yml".text = builtins.readFile (tmuxFormat.generate "ci.yml" { + session = "CI"; + root = "~/"; + windows = [ + { + name = "CI Status"; + commands = [ + "journalctl -xef -u xin-ci-update.service" + ]; + panes = [ + { + commands = [ "journalctl -xef -u xin-ci.service" ]; + } + ]; + } + { + commands = [ + "btop" + ]; + } + ]; + }); + etc."smug/main.yml".text = builtins.readFile (tmuxFormat.generate "main.yml" { + session = "Main"; + root = "~/"; + + windows = [ + { + name = "Status"; + commands = [ + "while true; do ssh -4 anonicb@slackers.openbsd.org; sleep 300; done" + ]; + panes = [ + { + commands = [ "mosh pwntie" ]; + } + ]; + } + { + name = "Barrier"; + commands = [ + "barriers -a 127.0.0.1 -f --disable-crypto" + ]; + panes = [ + { + commands = [ "ssh stan" ]; + } + ]; + } + { + name = "Xin"; + root = "src/xin"; + } + { + name = "Lab"; + root = "src/biltong"; + } + { + name = "NixPkgs"; + root = "src/nixpkgs"; + } + { + name = "NomadNet"; + root = "reticulum"; + } + ]; + }); + }; + }; +}