This PR fixes a performance regression noticed during the review of #35537.
Since commit 008a3e29c8844c0be4457279f5c27c1bc57401c7 ("guix: split builds into Linux(gui) and macOS/Windows"), each host is built in two containers: one instantiated from manifest_build.scm and the other from the union of manifest_build.scm and manifest_gui.scm. The resulting Guix profiles necessarily differ, and because $(realpath $(GUIX_ENVIRONMENT)) is hashed into every depends package id, the built-package cache is invalidated whenever the profile changes:
Depends are rebuilt when switching to another branch with identical Guix scripts and the depends subdirectory.
All non-GUI packages are built twice per host, as the GUI container cannot reuse the packages just cached by the base container (this is mostly relevant for non-Linux hosts, as we move towards static builds on Linux).
Drop GUIX_ENVIRONMENT from the gen_id inputs, and salt the depends ids in guix-build with the inputs that define the containers instead: the pinned time-machine commit, the contents of manifest_build.scm, manifest_gui.scm and of every patch in contrib/guix/patches, and the user-supplied ADDITIONAL_GUIX_*_FLAGS.
Unlike the profile path, this salt is identical for both containers of a given host, so the GUI container reuses the packages built by the base container, and it stays stable across branches whose Guix and depends inputs are unchanged, while any change to the pinned Guix revision, to the manifests, or to the patches still invalidates the cache.
Related: #34228.