From f3fd5eef5bbacfdd35cb03e1507f822e83473e89 Mon Sep 17 00:00:00 2001 From: Sigmanificient Date: Fri, 22 Dec 2023 02:22:56 +0100 Subject: [PATCH] Use better script import for wakatime on bash --- .bashrc | 22 ---------------------- home/bash/default.nix | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 25 deletions(-) delete mode 100644 .bashrc diff --git a/.bashrc b/.bashrc deleted file mode 100644 index 5fc74f5..0000000 --- a/.bashrc +++ /dev/null @@ -1,22 +0,0 @@ -# ~/.bashrc -# - -if [ $TERM = "linux" ]; then - setfont ter-116n -fi - -# If not running interactively, don't do anything -[[ $- != *i* ]] && return - -alias ls='ls --color=auto' -PS1='[\u@\h \W]\$ ' - -pre_prompt_command() { - version="1.0.0" - entity=$(echo $(fc -ln -0) | cut -d ' ' -f1) - [ -z "$entity" ] && return # $entity is empty or only whitespace - $(git rev-parse --is-inside-work-tree 2>/dev/null) && local project="$(basename $(git rev-parse --show-toplevel))" || local project="Terminal" - (~/.wakatime/wakatime-cli --write --plugin "bash-wakatime/$version" --entity-type app --project "$project" --entity "$entity" 2>&1 >/dev/null &) -} - -PROMPT_COMMAND="pre_prompt_command; $PROMPT_COMMAND" diff --git a/home/bash/default.nix b/home/bash/default.nix index 0b7435a..53e09cb 100644 --- a/home/bash/default.nix +++ b/home/bash/default.nix @@ -1,5 +1,12 @@ -{ ... }: -{ +{ pkgs, ... }: +let + bash-wakatime = pkgs.fetchFromGitHub { + owner = "gjsheep"; + repo = "bash-wakatime"; + rev = "c97292398936393c3f985f4924a3c234793ca3b8"; + sha256 = "sha256-Heq/VxfCqFhnYxAm2ejymANdPmZ5uNixuZiuC/53VQE="; + }; +in { programs.bash = { enable = true; @@ -16,7 +23,9 @@ dodo = "shutdown now"; - bashrcExtra = builtins.readFile ./../../.bashrc; + bashrcExtra = '' + source ${bash-wakatime}/bash-wakatime.sh + ''; }; };