Sounds like a nice idea, but I do not think its easy.
There are at least 2 important files as well on the AUR, as well as in the ABS.
PKGBUILD is a collection of variables and functions, which are sourced into a shell session for the build (loosely spoken). Especially does it contain a bunch of functions which do unpacking, patching, compiling, testing, stripping, installation. They do expect all
builddepends (not sure about the name right now) to be in
PATH as well as all
.SRCINFO contains a semi-easily parsable format that specifies some metadata again (extracted from
PKGBUILD earlier). Its basiccally just there that the server of the package database does not need to evaluate the bash script and needs to be up to date with the
PKGBUILD when comitting. It might be easier to parse this from
nix directly, though the only relation between checksums and input files is still only the order of appearance.
Not even to speak about the fact, that there are always hidden dependencies. Any package in the ABS can assume that all packages from
base (a package group) are installed. It can assume this during build and runtime. Packages from the
AUR can even assume
base-devel to be available at all times. I’m not sure if this is easily representable in a adjusted
absenv based on
Not even to speak about the fact that the functions for the phases in a
PKGBUILD make completely different assumptions about the environment they run in.
Last but not least, I have to admit, that there are a lot of packages on the AUR that don’t specifiy build dependencies correctly and therefore fail in a sandbox, but suceed on non-sandbox that has the tools installed because of other reasons. Those packages on the AUR can stay below the radar for quite a long time, as there are only a handfull of people currently that do sandboxed builds at all, because they either use only
makepkg or their AUR helper uses it, and doesn’t have an option for something else. Only a few people actually use (a wrapped)
makechrootpkg for building in a sandbox. I’m one of these and reporting issues as I discover them, but until they get fixed it takes time (if they get fixed at all).
Also remember, that dependencies don’t map 1:1 to some nix packages, so you had to recurse the dependencies and
abs2nix them as well. Not sure yet how to treat optional dependencies…
AUR packages built from VCS might be another problem, as their build output does depend on the VCS’ HEAD/TIP at build time and do not have a proper checksum.