Have a look at this blog post and program: Managing OpenBSD installed packages declaratively https://dataswamp.org/~solene/2022-05-05-openbsd-declarative-packages-with-pkgset.html
That's sure one idea, to have a config file (that's the "declarative" part) and then a script that converts that into commands of/to the traditional package manager to setup the system in accordance ... Anyone has that for Debian and Debian-like systems? -- underground experts united https://dataswamp.org/~incal