While writing your nvim stuff in lua, the vim object is automatically injected into your code by Neovim.
It allows getting and setting vim, plugins and variable related options in lua.
The gruvbox theme requires setting variables in the global scope. You can access the global scope using the vim.g field.
For example to set g:gruvbox_bold to 1, which is true in lua, you need to write
vim.g.gruvbox_bold = true
in your init.lua file.
I recommend you to take a look at this article.
https://www.notonlycode.org/neovim-lua-config/.
It is short and teaches the basics of using lua in Neovim.