From 079a2188f8d71a04d4351eac0ee1f25b04720f33 Mon Sep 17 00:00:00 2001 From: allthatjazzleo Date: Thu, 29 Feb 2024 17:08:55 +0800 Subject: [PATCH] add python bin and integrate session_recording --- cells/homemanager/programs/zsh.nix | 36 +++++++++++++++++++++++++----- cells/users/users.nix | 1 + 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/cells/homemanager/programs/zsh.nix b/cells/homemanager/programs/zsh.nix index 2b0a3a6..3b7ad85 100644 --- a/cells/homemanager/programs/zsh.nix +++ b/cells/homemanager/programs/zsh.nix @@ -44,6 +44,11 @@ }; history = {size = 100000;}; initExtraFirst = '' + # python + for dir in $(ls -rd $HOME/Library/Python/*); do + export PATH="$dir/bin:$PATH" + done + # End python # Cargo export PATH="$HOME/.cargo/bin:$PATH" # End Cargo @@ -56,11 +61,32 @@ export PATH="$HOME/.krew/bin:$PATH" # End krew ''; - initExtra = '' - bindkey '^f' autosuggest-accept - # agenix - export EDITOR="vim" - ''; + initExtra = + '' + bindkey '^f' autosuggest-accept + # agenix + export EDITOR="vim" + '' + + ( + if builtins.hasAttr "session_recording" user && user.session_recording + then '' + + # Check if we are currently in an asciinema session + if [[ -z "$ASCIINEMA_REC" ]]; then + # Set the environment variable to indicate the recording is in progress + export ASCIINEMA_REC=1 + + # Define where to save the asciinema recording files + ASCIINEMA_DIR="$HOME/.asciinema" + mkdir -p "$ASCIINEMA_DIR" + # Generate a unique filename for each session + FILENAME="$ASCIINEMA_DIR/session_$(date "+%Y-%m-%d_%H-%M-%S").cast" + # Start recording with asciinema + asciinema rec "$FILENAME" + fi + '' + else "" + ); }; fzf = { diff --git a/cells/users/users.nix b/cells/users/users.nix index 3f79bc2..9106349 100644 --- a/cells/users/users.nix +++ b/cells/users/users.nix @@ -24,6 +24,7 @@ in { ageIdentityPaths = ["~/.ssh/id_ed25519_homemanager"]; # zsh = false; # programs java = true; + session_recording = false; }; workuser = { email = "xx@xxx.com";