[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Want help with writing package recipe
From: |
Ludovic Courtès |
Subject: |
Re: Want help with writing package recipe |
Date: |
Fri, 07 Mar 2014 10:26:06 +0100 |
User-agent: |
Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) |
Hello,
Joshua Branson <address@hidden> skribis:
> Anyway, I used guix download <path to tarball> to download the
> tarball for gtypist. It is stored locally on my machine in this path:
> /nix/store/lzxd537h0plmskizrldx6lmpyacl2d40-gtypist-2.9.4.tar.gz
>
> I used guix hash -f base32 to export the base32 hash, which is:
> i5q225g6twsg5egicgpt6ub7hn4m7pdzg56hwxx57jm4o4ns5fgq
Note that ‘guix download’ already displays the SHA256, so using ‘guix
hash’ is not needed in this case (info "(guix) Invoking guix download").
> I've written a recipe for gtypist located here:
> http://pastebin.com/ysLHJUWg
(Please copy the expression inline next time, to make it easier.)
So you wrote:
--8<---------------cut here---------------start------------->8---
1. (use-modules (guix packages)
2. (guix download)
3. (guix build-system gnu)
4. (guix licenses))
5.
6. (define gtypist
7. (package
8. (name "gtypist")
9. (version "2.9.4")
10. (source (origin
11. (method url-fetch)
12. (uri (string-append "mirror://gnu/gtypist-" version
13. ".tar.gz"))
14. (sha256
15. (base32
"i5q225g6twsg5egicgpt6ub7hn4m7pdzg56hwxx57jm4o4ns5fgq"))))
16. (build-system gnu-build-system)
17. (inputs `(("perl" ,perl)))
18. (inputs `(("ncurses" ,ncurses)))
19. (synopsis "GNU Typist")
20. (description "The official GNU software to help improve your typing.")
21. (home-page "http://www.gnu.org/software/gtypist/")
22. (license gpl3+)))
--8<---------------cut here---------------end--------------->8---
This is perfect, and this is what the manual shows.
However, the manual is misleading, and that needs to be fixed. What the
manual doesn’t say is that we typically put package definitions in
modules, in the (gnu packages ...) hierarchy. This is the convention
that allows ‘guix build gtypist’ to find gtypist (I’ll correct the
manual to explain that.)
So you could write the above definition in its own module, by instead
starting with:
(define-module (gnu packages gtypist)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module (guix licenses)
#:use-module (gnu packages perl)
#:use-module (gnu packages ncurses))
and storing it as gnu/packages/gtypist.scm.
Then, from the Guix build tree, you should be able to run:
./pre-inst-env guix build gtypist
(./pre-inst-env asks to use the not-yet-installed Guix.)
Also note that the above definition has two ‘inputs’ fields, but there
should be only one.
I recommend looking at the other gnu/packages/*.scm files for examples,
and also Andreas’ talk at
<http://www.gnu.org/software/guix/guix-ghm-andreas-20130823.pdf>.
HTH,
Ludo’.