ENDPOINT=${ATTIC_ENDPOINT:-https://cachix.dgnum.eu}

if [ "$1" == "off" ]; then
	echo "Please edit $XDG_CONFIG_HOME/nix/nix.conf to remove the cache"
elif [ "$1" == "on" ]; then
	@attic@/bin/attic login dgnum "$ENDPOINT"
	@attic@/bin/attic use dgnum:infra
else
	echo "Help:"
	echo "  cache {on|off}"
fi