hercules-ci / flake-parts

❄️ Simplify Nix Flakes with the module system
https://flake.parts
MIT License
721 stars 41 forks source link

Documenting naming conventions #143

Closed Atry closed 1 year ago

Atry commented 1 year ago

Currently the file naming in this repository, e.g. moduleWithSystem.nix, is different from Nixpkgs coding conventions

Names of files and directories should be in lowercase, with dashes between words — not in camel case. For instance, it should be all-packages.nix, not allPackages.nix or AllPackages.nix.

It would nice to document why and what is the recommendation of file naming and hierarchy in projects using flake-parts.

shanesveller commented 1 year ago

Given how divorced Nix runtime logic/syntax is from the filesystem structure it's authored with, it's probably not needed for anyone to be particularly prescriptive about how others decide this in projects they themselves don't work on. Nixpkgs most likely only does so to try to keep that large body of code in some kind of consistency after hundreds of participants, since that linked passage is about "contributing to Nixpkgs", not "authoring Nix projects".

Downstream projects using flake-parts don't necessarily need to know or care what conventions the source code of flake-parts used, and can choose to converge on nixpkgs' conventions or any other standards that suit their tastes. It shouldn't materially impact anyone's ability to use flake-parts one way or the other.

roberth commented 1 year ago

I'm adding a "contributing" file in #144, which should clarify my reasoning. I agree with @shanesveller that it's mostly an internal thing for this repo, but I don't mind clarifying it a bit, and taking the opportunity to guide contributors (especially because this is not a contribution heavy repo at all).

roberth commented 1 year ago

@Atry

what is the recommendation of file naming and hierarchy in projects using flake-parts.

I don't have any recommendations, except for examples / templates. flake-parts is meant to be quite unopinionated; only a little more than flakes.

Does #144 answers the rest of your question somewhat?

Atry commented 1 year ago

Considering https://github.com/NixOS/nix/issues/6257, do we want to standardize the file naming and hierarchy?