guix package: Fix handling of `-e'.
[jackhill/guix/guix.git] / HACKING
CommitLineData
450ccdc3
LC
1-*- mode: org; coding: utf-8; -*-
2
08ba7ff3 3#+TITLE: Hacking GNU Guix and Its Incredible Distro
450ccdc3 4
9149f1a0 5Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
450ccdc3
LC
6
7 Copying and distribution of this file, with or without modification,
8 are permitted in any medium without royalty provided the copyright
9 notice and this notice are preserved.
10
11
08ba7ff3
LC
12* Running Guix before it is installed
13
14Command-line tools can be used even if you have not run "make install".
15To do that, prefix each command with ‘./pre-inst-env’, as in:
16
9bf3c1a7 17 ./pre-inst-env guix build --help
08ba7ff3
LC
18
19Similarly, for a Guile session using the Guix modules:
20
21 ./pre-inst-env guile -c '(use-modules (guix utils)) (pk (%current-system))'
22
23The ‘pre-inst-env’ script sets up all the environment variables
24necessary to support this.
25
c6dbd505
LC
26* The Perfect Setup
27
28The Perfect Setup to hack on Guix is basically the perfect setup used
29for Guile hacking (info "(guile) Using Guile in Emacs"). First, you
30need more than an editor, you need [[http://www.gnu.org/software/emacs][Emacs]], empowered by the wonderful
31[[http://nongnu.org/geiser/][Geiser]].
32
33Geiser allows for interactive and incremental development from within
34Emacs: code compilation and evaluation from within buffers, access to
35on-line documentation (docstrings), context-sensitive completion, M-. to
36jump to an object definition, a REPL to try out your code, and more.
37
38To actually edit the code, Emacs already has a neat Scheme mode. But in
39addition to that, you must not miss [[http://www.emacswiki.org/emacs/ParEdit][Paredit]]. It provides facilities to
40directly operate on the syntax tree, such as raising an s-expression or
41wrapping it, swallowing or rejecting the following s-expression, etc.
42
59b775cc
LC
43* Adding new packages
44
45Package recipes in Guix look like this:
46
47#+BEGIN_SRC scheme
48 (package
49 (name "nettle")
50 (version "2.5")
51 (source
52 (origin
3dc1970d
LC
53 (method url-fetch)
54 (uri (string-append "mirror://gnu/nettle/nettle-"
59b775cc
LC
55 version ".tar.gz"))
56 (sha256
57 (base32
58 "0wicr7amx01l03rm0pzgr1qvw3f9blaw17vjsy1301dh13ll58aa"))))
59 (build-system gnu-build-system)
08ba7ff3 60 (inputs `(("m4" ,m4)))
59b775cc
LC
61 (propagated-inputs `(("gmp" ,gmp)))
62 (home-page
63 "http://www.lysator.liu.se/~nisse/nettle/")
64 (synopsis "GNU Nettle, a cryptographic library")
65 (description
66 "Nettle is a cryptographic library...")
08ba7ff3 67 (license gpl2+))
59b775cc
LC
68#+END_SRC
69
70Such a recipe can be written by hand, and then tested by running
9bf3c1a7 71‘./pre-inst-env guix build nettle’.
59b775cc
LC
72
73When writing the recipe, the base32-encoded SHA256 hash of the source
74code tarball, which can be seen in the example above, can be obtained by
75running:
76
9bf3c1a7 77 guix download http://ftp.gnu.org/gnu/nettle/nettle-2.5.tar.gz
59b775cc
LC
78
79Alternatively, it is possible to semi-automatically import recipes from
80the [[http://nixos.org/nixpkgs/][Nixpkgs]] software distribution using this command:
81
9bf3c1a7 82 guix import /path/to/nixpkgs/checkout nettle
59b775cc
LC
83
84The command automatically fetches and converts to Guix the “Nix
85expression” of Nettle.
86
9bf3c1a7
LC
87* Submitting Patches
88
89Development is done using the Git distributed version control system. Thus,
90access to the repository is not strictly necessary. We welcome contributions
91in the form of patches as produced by ‘git format-patch’ sent to
92bug-guix@gnu.org. Please write commit logs in the [[http://www.gnu.org/prep/standards/html_node/Change-Logs.html#Change-Logs][GNU ChangeLog format]].
93
94As you become a regular contributor, you may find it convenient to have write
95access to the repository (see below.)
96
97* Commit Access
98
99For frequent contributors, having write access to the repository is
100convenient. When you deem it necessary, feel free to ask for it on the
101mailing list. When you get commit access, please make sure to follow the
102policy below (discussions of the policy can take place on bug-guix@gnu.org.)
103
104Non-trivial patches should always be posted to bug-guix@gnu.org (trivial
105patches include fixing typos, etc.)
106
107For patches that just add a new package, and a simple one, it’s OK to commit,
e20ec9cc
LC
108if you’re confident (which means you successfully built it in a chroot setup,
109and have done a reasonable copyright and license auditing.) Likewise for
110package upgrades. We have a mailing list for commit notifications
111(guix-commits@gnu.org), so people can notice. Before pushing your changes,
112make sure to run ‘git pull --rebase’.
9bf3c1a7
LC
113
114For anything else, please post to bug-guix@gnu.org and leave time for a
115review, without committing anything. If you didn’t receive any reply
116after two weeks, and if you’re confident, it’s OK to commit.
117
118That last part is subject to being adjusted, allowing individuals to commit
119directly on non-controversial changes on parts they’re familiar with.