(address . bug-guix@gnu.org)
I wanted to use an environment file that contains a package
definition, and use it with inferiors. Here is the full guix.scm:
Toggle snippet (71 lines)
(use-modules
(guix channels)
(guix inferior)
(guix build-system gnu)
(guix packages)
(guix licenses)
(gnu packages)
(ice-9 match))
(define channels
(list (channel
(name 'guix-bimsb)
(url "https://github.com/BIMSBbioinfo/guix-bimsb.git")
(commit
"be42b099867a29a68a9ffbf304dc7f9137b75fe3"))
(channel
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(commit
"01e33a031e493477d930b9383d397fea012a3b1a")
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
(openpgp-fingerprint
"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A
54FA"))))))
(define (lookup name)
(specification->package name))
(define (lookup-inferior name)
(define inferior
(inferior-for-channels channels))
(match (lookup-inferior-packages inferior name)
((first . rest) first)
(_ (error
(format #false "Could not find package `~a'.~%" name)))))
(define (p name)
(let* ((how (if (getenv "USE_GUIX_INFERIOR")
lookup-inferior lookup))
(pkg (how name)))
`(,name ,pkg)))
(define %version
(symbol->string (with-input-from-file "VERSION" read)))
(define-public my-package
(package
(name "my-package")
(version %version)
(source
(string-append (getcwd) "/my-package-" version ".tar.gz"))
(build-system gnu-build-system)
(inputs
(map p (list "bwa"
"r-minimal"
"r-rmarkdown"
"python-wrapper"
"python-pyyaml")))
(native-inputs
(map p (list "autoconf"
"automake")))
(home-page "TODO")
(synopsis "TODO")
(description "TODO")
(license gpl3+)))
my-package
The idea was that you would use the provided channels with
USE_GUIX_INFERIOR=t guix environment -l guix.scm
Unfortunately, this does not work, but there also is no error. I
end up in an environment where none of the declared inputs are
available. That’s because (guix scripts environments) has no
facilities to deal with packages that are of type
<inferior-package>.
--
Ricardo