diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2021-10-06 00:02:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-06 00:02:16 +0000 |
commit | 4bbe70b6f48856c642c73c7126a3c81d664ff852 (patch) | |
tree | c2724b42097087f12e24b3a4b6f7c3b13766aaad /doc | |
parent | 897b213c4eab596c594f2bc59a6fa3c32e9493cf (diff) | |
parent | f503135d4b9a655562bdbcc1c36eca1796b7e842 (diff) |
Merge staging-next into staging
Diffstat (limited to 'doc')
-rw-r--r-- | doc/contributing/coding-conventions.chapter.md | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/contributing/coding-conventions.chapter.md b/doc/contributing/coding-conventions.chapter.md index 85c8626bd99c4..7a8e7741a3302 100644 --- a/doc/contributing/coding-conventions.chapter.md +++ b/doc/contributing/coding-conventions.chapter.md @@ -181,6 +181,21 @@ rev = "${version}"; ``` +- Filling lists condionally _should_ be done with `lib.optional(s)` instead of using `if cond then [ ... ] else null` or `if cond then [ ... ] else [ ]`. + + ```nix + buildInputs = lib.optional stdenv.isDarwin iconv; + ``` + + instead of + + ```nix + buildInputs = if stdenv.isDarwin then [ iconv ] else null; + ``` + + As an exception, an explicit conditional expression with null can be used when fixing a important bug without triggering a mass rebuild. + If this is done a follow up pull request _should_ be created to change the code to `lib.optional(s)`. + - Arguments should be listed in the order they are used, with the exception of `lib`, which always goes first. ## Package naming {#sec-package-naming} |