From cffc18a485441f35810ec85cc7050d7364e6e87a Mon Sep 17 00:00:00 2001 From: osbm Date: Tue, 4 Feb 2025 16:49:08 +0300 Subject: [PATCH] add wanikani script --- modules/home.nix | 33 ++++++++++++++++++++++++++++++--- modules/wanikani-tmux.sh | 10 ++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100755 modules/wanikani-tmux.sh diff --git a/modules/home.nix b/modules/home.nix index 96a52fa..8264c35 100644 --- a/modules/home.nix +++ b/modules/home.nix @@ -3,7 +3,35 @@ pkgs, stateVersion, ... -}: { +}: +let + wanikani-script = builtins.path { + path = ./wanikani.sh; + }; + tmux-dracula = pkgs.tmuxPlugins.mkTmuxPlugin rec { + pluginName = "dracula"; + version = "3.0.0"; + src = pkgs.fetchFromGitHub { + owner = "dracula"; + repo = "tmux"; + rev = "v${version}"; + hash = "sha256-VY4PyaQRwTc6LWhPJg4inrQf5K8+bp0+eqRhR7+Iexk="; + }; + installPhase = '' + # i am adding my custom widget to the plugin here cp the wanikani.sh script to the plugin directory + cp ${wanikani-script} $out/scripts/wanikani.sh + ''; + meta = with pkgs.lib; { + homepage = "https://draculatheme.com/tmux"; + description = "Feature packed Dracula theme for tmux!"; + license = licenses.mit; + platforms = platforms.unix; + maintainers = with maintainers; [ ethancedwards8 ]; + }; + }; + +in +{ # Home Manager needs a bit of information about you and the # paths it should manage. home.username = "osbm"; @@ -64,9 +92,8 @@ plugins = with pkgs; [ tmuxPlugins.sensible tmuxPlugins.better-mouse-mode - # tmuxPlugins.dracula { - plugin = pkgs.tmuxPlugins.dracula; + plugin = tmux-dracula; extraConfig = '' set -g @dracula-plugins "cpu-usage ram-usage gpu-usage battery time" set -g @dracula-show-left-icon hostname diff --git a/modules/wanikani-tmux.sh b/modules/wanikani-tmux.sh new file mode 100755 index 0000000..34fd88e --- /dev/null +++ b/modules/wanikani-tmux.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +#!nix-shell -i bash -p jq curl +# Description: This script is used to display the current WaniKani review count in the tmux status bar. + +# curl -s -H "Authorization: Bearer 2da24e4a-ba89-4c4a-9047-d08f21e9dd01" "https://api.wanikani.com/v2/assignments?immediately_available_for_review=true" | jq '.total_count' + +# lets store the output of the above command in a variable +wanikani_reviews=$(curl -s -H "Authorization: Bearer 2da24e4a-ba89-4c4a-9047-d08f21e9dd01" "https://api.wanikani.com/v2/assignments?immediately_available_for_review=true" | jq '.total_count') + +echo $wanikani_reviews \ No newline at end of file