How to generate Mipmaps in a compute shader


I would like to generate Mipmaps of an image where I need a custom filter, so something else than offered by vkCmdBlitImage/VkFilter. Namely, I want to get the minimum or maximum of 4-texel blocks and generate the next Mipmap layer this way. Does it even make sense to store this as image Mipmaps or am I better off using a different mechanism?
If yes, how can I achieve this to write to a Mipmap layer from within a shader?