-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow .nix/flake.nix as an alternative to flake.nix #5064
Comments
Would this change anything with the requirement of the flake.nix to be tracked by version control? This is one of the issues I frequently encounter when working with projects that do not support Nix but I use Nix for local development. |
An idea I had this week was to seek a generic and more scalable solution. There is an IETF standards track RFC that defines a default folder for discovery of this kind of "meta-data": https://tools.ietf.org/html/rfc5785 ; it basically says: toss such files in a folder canonically named .well-known. This declutters the main folder and acts as a sandbox, to reduce the risk of collisions. The mechanism is used also by e.g. Let's Encrypt, Matrix, and many standards like webfinger, jmap, Do Not Track policies, etc) The cool thing is of course that wherever you have a self-hosted code repo (sftp://project.example.org), tossing in the repo with the nix flake in the .well-known location would immediately make the flake discoverable on the web for tools that understand .well-known. .Well-known comes with a registry ("the well-known URI registry"), and it should be straightforward to register flake.nix in it: https://www.iana.org/assignments/well-known-uris/well-known-uris.xhtml (it would work without claiming flake.nix through the registration too, but it would be following good practices to do so) From my perspective, there is no cost and only benefit to the wider software ecosystem if we all woud start using a consolidated well-known folder for the different packaging systems - rather than just having a folder with one file in it named after the packaging mechanism. |
To comment to that concern: dotFiles and dotFolders by default are tracked by version control systems like git like anything else you put into the folder. Git for instance even uses them itself for core functionality, e.g. for the .gitignore file which is used to flag files that are present in the folder but should be kept out of git. You can use the .gitignore file to change the default behaviour, and not track your local flake.nix, .nix/flake.nix or .well-known/flake.nix (wherever this ends up). |
This may be problematic when you try to implement something like #4612 in the future because you are essentially saying that a flake contains the contents of whatever directory I'm not saying this isn't a good idea (it may improve UX), but please consider it very carefully. I treat |
I suggest 3 names:
This way it is very easy to choose which kind of "pollution" you like. The nix folder has the advantage to be visible but only have one folder ever top level. Last one is for the project with problematic people |
Some people don't want to pollute the root directory of their repo with stuff like
flake.nix
. So similar to.github
, we could put files likeflake.nix
in a hidden.nix
directory.To avoid ambiguity it should be an error if both
flake.nix
and.nix/flake.nix
exist.CC @leenaars.
The text was updated successfully, but these errors were encountered: