diff options
| author | Nicolas Graves <ngraves@ngraves.fr> | 2026-04-03 10:04:57 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2026-05-07 17:34:44 +0200 |
| commit | 10bf5b6c2975088828c0b151d17cbb3e451d300c (patch) | |
| tree | aeea3a587961a77b46c716a5b7dce85446cbe118 | |
| parent | c7871f61115e62070ddfad40906a19eea417037d (diff) | |
doc: Rebalance guix style inputs description.
* doc/guix.texi: It seems that there were two places where styling
rules were declared, and one was vastly outdated. Only describe
styling rules once instead, and move their specific discussion where
the styling rule is described.
Change-Id: Ic83d4c59e45ed51f63dfe91e624b6f453a800818
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| -rw-r--r-- | doc/guix.texi | 86 |
1 files changed, 38 insertions, 48 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 5a6ddf44ad7..70677e24446 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
| @@ -15994,51 +15994,10 @@ Use @var{host} as the OpenPGP key server when importing a public key. | |||
| 15994 | @cindex format conventions | 15994 | @cindex format conventions |
| 15995 | The @command{guix style} command helps users and packagers alike style | 15995 | The @command{guix style} command helps users and packagers alike style |
| 15996 | their package definitions and configuration files according to the | 15996 | their package definitions and configuration files according to the |
| 15997 | latest fashionable trends. It can either reformat whole files, with the | 15997 | latest fashionable trends, or patch them with specific rewrites. It can |
| 15998 | @option{--whole-file} option, or apply specific @dfn{styling rules} to | 15998 | either reformat whole files, with the @option{--whole-file} option, or |
| 15999 | individual package definitions. The command currently provides the | 15999 | apply specific @dfn{styling rules} to individual package definitions. |
| 16000 | following styling rules: | 16000 | The command provides multiple styling rules, explained below. |
| 16001 | |||
| 16002 | @itemize | ||
| 16003 | @item | ||
| 16004 | formatting package definitions according to the project's conventions | ||
| 16005 | (@pxref{Formatting Code}); | ||
| 16006 | |||
| 16007 | @item | ||
| 16008 | rewriting package inputs to the ``new style'', as explained below. | ||
| 16009 | @end itemize | ||
| 16010 | |||
| 16011 | The way package inputs are written is going through a transition | ||
| 16012 | (@pxref{package Reference}, for more on package inputs). Until version | ||
| 16013 | 1.3.0, package inputs were written using the ``old style'', where each | ||
| 16014 | input was given an explicit label, most of the time the package name: | ||
| 16015 | |||
| 16016 | @lisp | ||
| 16017 | (package | ||
| 16018 | ;; @dots{} | ||
| 16019 | ;; The "old style" (deprecated). | ||
| 16020 | (inputs `(("libunistring" ,libunistring) | ||
| 16021 | ("libffi" ,libffi)))) | ||
| 16022 | @end lisp | ||
| 16023 | |||
| 16024 | Today, the old style is deprecated and the preferred style looks like | ||
| 16025 | this: | ||
| 16026 | |||
| 16027 | @lisp | ||
| 16028 | (package | ||
| 16029 | ;; @dots{} | ||
| 16030 | ;; The "new style". | ||
| 16031 | (inputs (list libunistring libffi))) | ||
| 16032 | @end lisp | ||
| 16033 | |||
| 16034 | Likewise, uses of @code{alist-delete} and friends to manipulate inputs | ||
| 16035 | is now deprecated in favor of @code{modify-inputs} (@pxref{Defining | ||
| 16036 | Package Variants}, for more info on @code{modify-inputs}). | ||
| 16037 | |||
| 16038 | In the vast majority of cases, this is a purely mechanical change on the | ||
| 16039 | surface syntax that does not even incur a package rebuild. Running | ||
| 16040 | @command{guix style -S inputs} can do that for you, whether you're working on | ||
| 16041 | packages in Guix proper or in an external channel. | ||
| 16042 | 16001 | ||
| 16043 | The general syntax is: | 16002 | The general syntax is: |
| 16044 | 16003 | ||
| @@ -16101,14 +16060,45 @@ definition of the Coreutils package like so: | |||
| 16101 | @end example | 16060 | @end example |
| 16102 | 16061 | ||
| 16103 | @item inputs | 16062 | @item inputs |
| 16104 | Rewrite package inputs to the ``new style'', as described above. This | 16063 | Rewrite package inputs to the ``new style''. This is how you would |
| 16105 | is how you would rewrite inputs of package @code{whatnot} in your own | 16064 | rewrite inputs of package @code{whatnot} in your own channel: |
| 16106 | channel: | ||
| 16107 | 16065 | ||
| 16108 | @example | 16066 | @example |
| 16109 | guix style -L ~/my/channel -S inputs whatnot | 16067 | guix style -L ~/my/channel -S inputs whatnot |
| 16110 | @end example | 16068 | @end example |
| 16111 | 16069 | ||
| 16070 | The way package inputs are written is going through a transition | ||
| 16071 | (@pxref{package Reference}, for more on package inputs). Until version | ||
| 16072 | 1.3.0, package inputs were written using the ``old style'', where each | ||
| 16073 | input was given an explicit label, most of the time the package name: | ||
| 16074 | |||
| 16075 | @lisp | ||
| 16076 | (package | ||
| 16077 | ;; @dots{} | ||
| 16078 | ;; The "old style" (deprecated). | ||
| 16079 | (inputs `(("libunistring" ,libunistring) | ||
| 16080 | ("libffi" ,libffi)))) | ||
| 16081 | @end lisp | ||
| 16082 | |||
| 16083 | Today, the old style is deprecated and the preferred style looks like | ||
| 16084 | this: | ||
| 16085 | |||
| 16086 | @lisp | ||
| 16087 | (package | ||
| 16088 | ;; @dots{} | ||
| 16089 | ;; The "new style". | ||
| 16090 | (inputs (list libunistring libffi))) | ||
| 16091 | @end lisp | ||
| 16092 | |||
| 16093 | Likewise, uses of @code{alist-delete} and friends to manipulate inputs | ||
| 16094 | is now deprecated in favor of @code{modify-inputs} (@pxref{Defining | ||
| 16095 | Package Variants}, for more info on @code{modify-inputs}). | ||
| 16096 | |||
| 16097 | In the vast majority of cases, this is a purely mechanical change on the | ||
| 16098 | surface syntax that does not even incur a package rebuild. Running | ||
| 16099 | @command{guix style -S inputs} can do that for you, whether you're working on | ||
| 16100 | packages in Guix proper or in an external channel. | ||
| 16101 | |||
| 16112 | Rewriting is done in a conservative way: preserving comments and bailing | 16102 | Rewriting is done in a conservative way: preserving comments and bailing |
| 16113 | out if it cannot make sense of the code that appears in an inputs field. | 16103 | out if it cannot make sense of the code that appears in an inputs field. |
| 16114 | The @option{--input-simplification} option described below provides | 16104 | The @option{--input-simplification} option described below provides |
