feat(scripts): Add script to get a Minecraft account UUID
This commit is contained in:
parent
deab672810
commit
a380da80a1
3 changed files with 20 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
{ pkgs, ... }: {
|
||||
imports = [ ./development.nix ./zsh.nix ];
|
||||
imports = [ ./development.nix ./scripts ./zsh.nix ];
|
||||
home = {
|
||||
username = "avery";
|
||||
homeDirectory = "/home/avery";
|
||||
|
|
3
common/home-manager/scripts/default.nix
Normal file
3
common/home-manager/scripts/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{ pkgs, ... }: {
|
||||
home.packages = [ (import ./get-minecraft-uuid.nix { inherit pkgs; }) ];
|
||||
}
|
16
common/home-manager/scripts/get-minecraft-uuid.nix
Normal file
16
common/home-manager/scripts/get-minecraft-uuid.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "get-minecraft-uuid";
|
||||
runtimeInputs = with pkgs; [ curl jq gnused ];
|
||||
text = ''
|
||||
usage() {
|
||||
echo "USAGE: get-minecraft-uuid USERNAME"
|
||||
exit 1
|
||||
}
|
||||
|
||||
test -n "$1" || usage
|
||||
|
||||
curl -s "https://api.mojang.com/users/profiles/minecraft/$1" | jq -r ".id" | sed -r "s/^(\w{8})(\w{4})(\w{4})(\w{4})(\w{12})$/\1-\2-\3-\4-\5/"
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue