Hello, Kurome <hunt31...@gmail.com> writes:
> I see search-input-file and search-input-directory used to specify file paths > of > input packages, like this: > > (search-input-file inputs "bin/foo") > > From my observation, this can also be rewritten as: > > (string-append #$(this-package-input "package-foo") "/bin/foo") > > #$(file-append (this-package-input "package-foo") "/bin/foo") These are not fully equivalent: ‘this-package-input’ relies on “input labels” (roughly, package names) and ‘search-input-file’ does not. So (search-input-file inputs "/bin/cp") will work whether one provides Coreutils or Busybox as an input, for example, and this is most of the time an important property (in particular with ‘package-input-rewriting’ as Maxim wrote). > While the search-input-file may look more elegant, it can sometimes be harder > for someone to review and understand its meaning, as it’s not clear which > package provides "bin/foo" at first glance. True, but keep in mind that ‘search-input-file’ errors out if it cannot find said file. IOW, if the package builds, then “bin/foo” was found in one of the inputs. Overall, I recommend ‘search-input-file’. See also <https://guix.gnu.org/en/blog/2021/the-big-change/> for a discussion of input labels. Ludo’.