* Re: Want help with writing package recipe
2014-03-06 23:03 ` Want help with writing package recipe Joshua Branson
@ 2014-03-07 9:26 ` Ludovic Courtès
2014-03-07 9:41 ` Nikita Karetnikov
1 sibling, 0 replies; 3+ messages in thread
From: Ludovic Courtès @ 2014-03-07 9:26 UTC (permalink / raw)
To: Joshua Branson; +Cc: guix-devel
Hello,
Joshua Branson <jbranso@purdue.edu> 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’.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Want help with writing package recipe
2014-03-06 23:03 ` Want help with writing package recipe Joshua Branson
2014-03-07 9:26 ` Ludovic Courtès
@ 2014-03-07 9:41 ` Nikita Karetnikov
1 sibling, 0 replies; 3+ messages in thread
From: Nikita Karetnikov @ 2014-03-07 9:41 UTC (permalink / raw)
To: Joshua Branson; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 3095 bytes --]
> I used guix hash -f base32 to export the base32 hash, which is:
> i5q225g6twsg5egicgpt6ub7hn4m7pdzg56hwxx57jm4o4ns5fgq
You need ‘nix-base32’, which is the default format, so use ‘guix hash’.
> I've written a recipe for gtypist located here:
> http://pastebin.com/ysLHJUWg
Please include everything in the message body. Otherwise, some
information may get lost in the future.
> (use-modules (guix packages)
> (guix download)
> (guix build-system gnu)
> (guix licenses))
You must use ‘define-module’ instead. See the recipes under
‘gnu/packages’ in the source tree, e.g., ‘wget.scm’.
> (define gtypist
Guix can’t access the definition if it’s not public, so substitute the
above with ‘define-public’.
> (package
> (name "gtypist")
> (version "2.9.4")
> (source (origin
> (method url-fetch)
> (uri (string-append "mirror://gnu/gtypist-" version
> ".tar.gz"))
> (sha256
> (base32 "i5q225g6twsg5egicgpt6ub7hn4m7pdzg56hwxx57jm4o4ns5fgq"))))
Don’t forget to recompute the hash.
> (build-system gnu-build-system)
> (inputs `(("perl" ,perl)))
> (inputs `(("ncurses" ,ncurses)))
No need for two ‘input’ fields here. See the definition of ‘coreutils’
in ‘gnu/packages/base.scm’ for an example.
> (synopsis "GNU Typist")
> (description "The official GNU software to help improve your typing.")
> (home-page "http://www.gnu.org/software/gtypist/")
Make sure to run ‘make sync-descriptions’ to check the above. Use the
proposed synopsis and description.
> (license gpl3+)))
> But now, I'm stuck. I'm not sure how to tell guix to run the
> recipe. Guix's documentation says that the command "guix build options
> package-or-derivation"
> will build the package into a binary that I can run on my
> machine. I can't say "guix build gtypist", because guix does not
> currently have a recipe to build gtypist, and I can't say "guix
> build options /path/to/gtypist.dri", because there is not a derivation
> file on my machine for gtypist.
Put the code in a file, say, ‘gnu/packages/gtypist.scm’. Then, run
‘guix build -K gtypist’ in order to build it. If any errors occur, try
to get some hints by running (from the root of your guix directory)
$ ./pre-inst-env guile
scheme@(guile-user)> ,use (gnu packages gtypist)
> How do I submit a patch when I get it working?
See the “Submitting Patches” section in ‘HACKING’. Basically, you add
the needed files with ‘git add’, commit them with ‘git commit’, and
produce the patch with ‘git format-patch’. After that you send the
patch to the list. Your patch should look similar to this one [1].
Also, there is a packaging tutorial [2].
[1] http://git.savannah.gnu.org/cgit/guix.git/commit/?id=ece262461625e80957d904f39a6818286099d367
[2] https://gnu.org/software/guix/guix-ghm-andreas-20130823.pdf
[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread