From dd87bb822c9c8873fe5ff914295cea6ecec2e825 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 6 May 2023 21:09:28 +0200 Subject: [PATCH 1/3] Create CONTRIBUTING.md --- CONTRIBUTING.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..37cfb73 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,34 @@ + +# How do I contribute? + +Flake-parts is designed to be extremely modular, so often, you don't have to. + +Nonetheless, some changes can only be made here. + +Step 1. Look for an open or closed issue. This may be the quickest path to a solution to your problem. + +Step 2. If needed, open an issue. This way we can discuss the problem, and if necessary discuss changes, if any need to be made. + +Step 3. If needed, create a PR. Make sure to run `nix-shell` before comitting. It installs a pre-commit hook with `nixpkgs-fmt`. + + +# Style + +This repository is written in a style similar to that of Nixpkgs, with some exceptions + + - File names may be in camelCase. This reduces the number of unique names in the project. + + - The "contains attribute" operator is spelled without spaces, just like the "select attribute" operator. I believe Nixpkgs is undecided on this. + ```nix + if x?a then "has a" else "does not have a" + # ^^^ + ``` + +Except for file names, the Nixpkgs casing rule is maintained here as well: + + - Package names are verbatim or in snake-case. Example: + - `flake-parts-lib` + + - Functionality provided by flake-parts is in camelCase. Examples: + - `getSystem` + - `mkFlake` From 7b027db864215cb5a5dd0ef2201985e6039d6d6f Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 6 May 2023 21:19:46 +0200 Subject: [PATCH 2/3] CONTRIBUTING: Formatting is not that important --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 37cfb73..427beb2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,6 +14,8 @@ Step 3. If needed, create a PR. Make sure to run `nix-shell` before comitting. I # Style +Rule #1. Go with the flow. Write code that fits in. Don't reformat existing code. Don't obsess over fitting in. Write good docs and tests instead. + This repository is written in a style similar to that of Nixpkgs, with some exceptions - File names may be in camelCase. This reduces the number of unique names in the project. From df88875d39709d7e107f11d0987808b52e102673 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 7 May 2023 13:25:12 +0200 Subject: [PATCH 3/3] CONTRIBUTING.md: More rules on request --- CONTRIBUTING.md | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 427beb2..22b96c7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,18 +14,18 @@ Step 3. If needed, create a PR. Make sure to run `nix-shell` before comitting. I # Style -Rule #1. Go with the flow. Write code that fits in. Don't reformat existing code. Don't obsess over fitting in. Write good docs and tests instead. +This repository is written in a style similar to that of Nixpkgs, with some exceptions. +The following sections describe such additions, exceptions, and it probably confirms some rules. + +## Rule #1. Go with the flow + +Write code that fits in. Don't reformat existing code. Don't obsess over fitting in. Write good docs and tests instead. + +## Camel case -This repository is written in a style similar to that of Nixpkgs, with some exceptions - File names may be in camelCase. This reduces the number of unique names in the project. - - The "contains attribute" operator is spelled without spaces, just like the "select attribute" operator. I believe Nixpkgs is undecided on this. - ```nix - if x?a then "has a" else "does not have a" - # ^^^ - ``` - Except for file names, the Nixpkgs casing rule is maintained here as well: - Package names are verbatim or in snake-case. Example: @@ -34,3 +34,25 @@ Except for file names, the Nixpkgs casing rule is maintained here as well: - Functionality provided by flake-parts is in camelCase. Examples: - `getSystem` - `mkFlake` + +## Operators and such + +- The "contains attribute" operator is spelled without spaces, just like the "select attribute" operator. I believe Nixpkgs is undecided on this. + + ```nix + if x?a then x.a else "does not have a" + # ^^^ + ``` + +- `@` pattern goes before and uses no extra spaces. + + ```nix + # immediately before parameter list when single line + pair@{ name, value }: + + # newline after @ when multi-line + pair@ + { name + , value + } + ```