nixos/scripts/personal-cache.sh

22 lines
404 B
Bash

#!/bin/bash
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