diff options
-rw-r--r-- | hosts/muhammed/extra-utils.nix | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/hosts/muhammed/extra-utils.nix b/hosts/muhammed/extra-utils.nix index 5cdd11c..95c29b9 100644 --- a/hosts/muhammed/extra-utils.nix +++ b/hosts/muhammed/extra-utils.nix @@ -4,6 +4,23 @@ xkcdpass' = pkgs.writeShellScriptBin "xkcdpass" '' ${pkgs.xkcdpass}/bin/xkcdpass --delimiter="" --case capitalize --numwords=5 "$@" ''; + + mcinfo = let + jq-script = pkgs.writeText "minecraft.jq" '' + .version as $v + | .description as $d + | .players as $p + | (if env.NO_COLOR == null then "\u001b[1m" else "" end) as $bold + | (if env.NO_COLOR == null then "\u001b[0m" else "" end) as $reset + | "\($bold)Version:\($reset) \($v.name) (\($v.protocol))", + "\($bold)Description:\($reset) \($d)", + "\($bold)Players online\($reset): \($p.online)" + ''; + in + pkgs.writeShellScriptBin "mcinfo" '' + set -x -u -o pipefail + ${pkgs.mcping}/bin/mcping "$@" | jq --raw-output --from-file ${jq-script} + ''; in { home.packages = with pkgs; [ imagemagick @@ -11,5 +28,9 @@ in { # Generating passwords xkcdpass' + + # Quick monitoring of Minecraft servers + mcping + mcinfo ]; } |