Hello,
I am new to Guix and want to add data from an external
source to
my package build. More precisely, I am trying to install the
library
casacore and need to add data in its subdirectory
share/casacore/data. I can download these data as tar via
ftp. For
now, my code looks like this :
"
(defineWSRT_Measures
(origin
(method url-fetch)
(uri "[...not sure I can disclose...]/WSRT_Measures.ztar")
(sha256
(base32 "1d9qlcmkpsnw8wm7sidp17iwd2d771nsgjwwp568886g5f239a8k"))
)
)
(define-public casacore
(package
(name "casacore")
(version "3.5.0")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/casacore/casacore.git")
(recursive? #t)
(commit "v3.5.0")))
(file-name (git-file-name name version))
(sha256 (base32
"0zw70slc3681mnadg169avjg7d3jwn1x49xn0022207blcig8g2l"))))
(inputs
(listfftwf fftw openblas boost gcc-toolchain git gsl lapack
gfortran-toolchain readline flex bison cfitsio wcslib python
python-numpy
))
(build-system cmake-build-system)
(arguments (list
#:configure-flags #~(list"-DHELLO_WHO=Guix""-DBUILD_DYSCO=ON")
#:build-type "Release"
#:tests? #f;; some test are failing due to lack of data that are
downloable via ftp for now testing is disable
#:parallel-build? #t;; TODO : check if it makes a difference in
building time
#:phases
#~(modify-phases %standard-phases
(add-after 'install'install-data
(lambda* (#:key inputs outputs #:allow-other-keys)
(let*(
(out (assoc-ref outputs "out"))
(data (list-ref(find-files "/gnu/store""WSRT_Measures.ztar")0))
(share-dir (string-append out "/share/casacore/data/"))
)
(mkdir-p share-dir)
(invoke "tar""-xzf"data "-C"share-dir)
#t))))
))
(home-page "http://casacore.github.io/casacore/")
(synopsis "")
(description "A suite of C++ libraries for radio astronomy data
processing.")
(license license:gpl2+)))
"
And it seems to work but I am sure there are far better ways to
do
this than my "take the first element of an overall find-files on
/gnu/store/". Can someone teach me these better ways ?
Thanks,
Aristide Doussot