nixos/scripts/personal-cache.sh

22 lines
404 B
Bash
Raw Normal View History

#!/bin/bash
2022-06-18 15:02:00 +02:00
store="http://cache.home"
action="$1"
function print_help() {
printf "Usage:\n"
printf " %s [ ping | url ]" "$0"
exit 1
}
if [ -z "${action+x}" ]; then
print_help
elif [ "$action" = "--ping" ]; then
nix store ping --store "$store" --option connect-timeout 1 --option download-attempt 1 2>/dev/null
elif [ "$action" = "--url" ]; then
printf "%s" "$store"
else
print_help
fi