NMR chemical shifts in periodic systems from first principles