summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2025-02-08 16:28:37 +0100
committerLinnnus <[email protected]>2025-02-08 16:28:37 +0100
commit645ec7c7a5069a246a53e46b16d99b091d6b7328 (patch)
tree17f8b47b89964c3878db0000d38c288befa2c42b
parent5558a99b9849ee030e3e7bed847017d19ec5e906 (diff)
muhammed: Add mcping to path
-rw-r--r--hosts/muhammed/extra-utils.nix21
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
];
}