summaryrefslogtreecommitdiff
path: root/HACKING
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@openmailbox.org>2015-06-10 13:39:54 +0200
committerMathieu Lirzin <mthl@openmailbox.org>2015-06-14 01:44:54 +0200
commit8c01b9d05aa5d5449398d5babdf7fa1fe95af1c2 (patch)
tree808a187b58b51c8ceda4f3b0a5509e525cb9ab58 /HACKING
parent932e7204afbe6d56b8319f7c298ea43e12004a95 (diff)
doc: Move most 'HACKING' informations into the manual.
* HACKING (Contributing): New section. (Building from Git, The Perfect Setup, Coding Style, Submitting Patches): Move to ... * doc/guix.texi (Running Guix Before It Is Installed): Likewise. * doc/contributing.texi: ... here. New file. * doc.am (EXTRA_DIST): Use it. * README (Installation): Adapt to it. * configure.ac (DOT): Likewise.
Diffstat (limited to 'HACKING')
-rw-r--r--HACKING133
1 files changed, 6 insertions, 127 deletions
diff --git a/HACKING b/HACKING
index 1e742c8454c..41838ee816a 100644
--- a/HACKING
+++ b/HACKING
@@ -2,141 +2,20 @@
2 2
3#+TITLE: Hacking GNU Guix and Its Incredible Distro 3#+TITLE: Hacking GNU Guix and Its Incredible Distro
4 4
5Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org> 5Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
6Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> 6Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
7Copyright © 2014 Pierre-Antoine Rault <par@rigelk.eu>
8 7
9 Copying and distribution of this file, with or without modification, 8 Copying and distribution of this file, with or without modification,
10 are permitted in any medium without royalty provided the copyright 9 are permitted in any medium without royalty provided the copyright
11 notice and this notice are preserved. 10 notice and this notice are preserved.
12 11
12* Contributing
13 13
14* Building from Git 14See the manual for useful hacking informations, either by running
15 15
16When building Guix from a checkout, the following packages are required in 16 info -f doc/guix.info "(guix) Contributing"
17addition to those mentioned in the installation instructions:
18 17
19 - [[http://www.gnu.org/software/autoconf/][GNU Autoconf]] 18or by checking the [[http://www.gnu.org/software/guix/manual/guix.html#Contributing][web copy of the manual]].
20 - [[http://www.gnu.org/software/automake/][GNU Automake]]
21 - [[http://www.gnu.org/software/gettext/][GNU Gettext]]
22 - [[http://www.graphviz.org/][Graphviz]]
23 - [[http://www.gnu.org/software/help2man/][GNU Help2man]] (optional)
24
25Run ‘./bootstrap’ to download the Nix daemon source code and to generate the
26build system infrastructure using autoconf. It reports an error if an
27inappropriate version of the above packages is being used.
28
29If you get an error like this one:
30
31 configure.ac:46: error: possibly undefined macro: PKG_CHECK_MODULES
32
33it probably means that Autoconf couldn’t find ‘pkg.m4’, which is provided by
34pkg-config. Make sure that ‘pkg.m4’ is available. For instance, if you
35installed Automake in ‘/usr/local’, it wouldn’t look for ‘.m4’ files in
36‘/usr/share’. So you have to invoke the following command in that case
37
38 $ export ACLOCAL_PATH=/usr/share/aclocal
39
40See “info '(automake) Macro Search Path'” for more information.
41
42Then, run ‘./configure’ as usual.
43
44Finally, you have to invoke ‘make check’ to run tests. If anything fails,
45take a look at “info '(guix) Installation'” or send a message to
46<guix-devel@gnu.org>.
47
48* Running Guix before it is installed
49
50See the same-named section in the manual.
51
52* The Perfect Setup
53
54The Perfect Setup to hack on Guix is basically the perfect setup used
55for Guile hacking (info "(guile) Using Guile in Emacs"). First, you
56need more than an editor, you need [[http://www.gnu.org/software/emacs][Emacs]], empowered by the wonderful
57[[http://nongnu.org/geiser/][Geiser]].
58
59Geiser allows for interactive and incremental development from within
60Emacs: code compilation and evaluation from within buffers, access to
61on-line documentation (docstrings), context-sensitive completion, M-. to
62jump to an object definition, a REPL to try out your code, and more.
63
64To actually edit the code, Emacs already has a neat Scheme mode. But in
65addition to that, you must not miss [[http://www.emacswiki.org/emacs/ParEdit][Paredit]]. It provides facilities to
66directly operate on the syntax tree, such as raising an s-expression or
67wrapping it, swallowing or rejecting the following s-expression, etc.
68
69* Submitting Patches
70
71Development is done using the Git distributed version control system. Thus,
72access to the repository is not strictly necessary. We welcome contributions
73in the form of patches as produced by ‘git format-patch’ sent to
74guix-devel@gnu.org. Please write commit logs in the [[http://www.gnu.org/prep/standards/html_node/Change-Logs.html#Change-Logs][GNU ChangeLog
75format]]; you can check the commit history for examples.
76
77Before submitting a patch that adds or modifies a package definition, please
78run ‘guix lint PACKAGE’, where PACKAGE is the name of the new or modified
79package, and fix any errors it reports. In addition, please make sure the
80package builds on your platform, using ‘guix build’. You may also want to
81check that dependent package (if applicable) are not affected by the change;
82‘guix refresh --list-dependent PACKAGE’ will help you do that.
83
84When posting a patch to the mailing list, use "[PATCH] ..." as a subject. You
85may use your email client or the ‘git send-mail’ command.
86
87As you become a regular contributor, you may find it convenient to have write
88access to the repository (see below.)
89
90* Coding Style
91
92In general our code follows the [[info:standards][GNU Coding Standards]] (GCS). However, the GCS
93do not say much about Scheme, so here are some additional rules.
94
95** Programming Paradigm
96
97Scheme code in Guix is written in a purely functional style. One exception is
98code that involves input/output, and procedures that implement low-level
99concepts, such as the ‘memoize’ procedure.
100
101** Modules
102
103Guile modules that are meant to be used on the builder side must live in the
104(guix build …) name space. They must not refer to other Guix or GNU modules.
105However, it is OK for a “host-side” module to use a build-side module.
106
107Modules that deal with the broader GNU system should be in the (gnu …) name
108space rather than (guix …).
109
110** Data Types and Pattern Matching
111
112The tendency in classical Lisp is to use lists to represent everything, and
113then to browse them “by hand” using ‘car’, ‘cdr’, ‘cadr’, and co. There are
114several problems with that style, notably the fact that it is hard to read,
115error-prone, and a hindrance to proper type error reports.
116
117Guix code should define appropriate data types (for instance, using
118‘define-record-type*’) rather than abuse lists. In addition, it should use
119pattern matching, via Guile’s (ice-9 match) module, especially when matching
120lists.
121
122** Formatting Code
123
124When writing Scheme code, we follow common wisdom among Scheme programmers.
125In general, we follow the [[http://mumble.net/~campbell/scheme/style.txt][Riastradh's Lisp Style Rules]]. This document happens
126to describe the conventions mostly used in Guile’s code too. It is very
127thoughtful and well written, so please do read it.
128
129Some special forms introduced in Guix, such as the ‘substitute*’ macro, have
130special indentation rules. These are defined in the .dir-locals.el file,
131which Emacs automatically uses. If you do not use Emacs, please make sure to
132let your editor know the rules.
133
134We require all top-level procedures to carry a docstring. This requirement
135can be relaxed for simple private procedures in the (guix build …) name space,
136though.
137
138Procedures should not have more than four positional parameters. Use keyword
139parameters for procedures that take more than four parameters.
140 19
141* Commit Access 20* Commit Access
142 21