add wanikani script

This commit is contained in:
Osman Faruk Bayram 2025-02-04 16:49:08 +03:00
parent 8eaac613fc
commit cffc18a485
2 changed files with 40 additions and 3 deletions

View file

@ -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

10
modules/wanikani-tmux.sh Executable file
View file

@ -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