First of all, guix has excellent built-in capabilities for modifying existing packages.
Perhaps the easiest way is to use package transformation options:
guix install tome4 --with-source=file:///home/user/random-directory/tome4.tar.gz
The other way is to define package variants. It is essentially the same as the first, but is done at the package definition level:
(define-module (my-tome4)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (gnu packages games))
(define-public my-tome4
(package
(inherit tome4)
(source
(origin
(method url-fetch)
(uri "file:///home/user/random-directory/tome4.tar.gz")
(sha256
(base32 "sha256checksumgoeshere"))
(modules '((guix build utils)))))))
Here’s a tip on how to use your own guile modules with guix packages.
Also remember that the module names and file names in guile must match each other:
(packages tome4) = packages/tome4.scm
If the names of your package and the original package are the same, you can use the --install-from-expression=
option to specify which module the package should be taken from:
guix package -e '(@ (my-tome4) tome4)'
Lastly, I believe this should be done the way it is done in the obs package. There is a search path variable that specifies where the plugins should be loaded from, and thus the plugins can be packaged separately.