Flakes efficient usage / setup - ad-hoc environments

instead of (used with legacy) nix-shell
with nixFlakes concepts/commands

  • the/a file in a (more or less clean) directory has to be named “flake.nix”? - is not a flake (because it doesn't contain a 'flake.nix' file)
    – means implicit that meaningful/semantic naming can only be done via the directory name?
  • it is not possible to call a specific file with an arbitrarily name *.nix?
  • it not possible to have more than one flake.nix in a directory?
  • it cannot be used without the file been added via git (outside of a git context)?
  1. The flake.nix is the entrypoint to the project, it makes sense to have a single common name for it.
  2. Not sure what you mean by “call a specific file”, files are commonly read or written to, but not “called”.
  3. Of course not. You can not have multiple files with the same name in a single directory, though in my opinion, having many projects in a single directory isn’t something you usually do anyways
  4. Sadly yes. If your project is under a version controll that is supported by flakes, you have to add the flake.nix and the flake.lock under version control. Of all the mentioned things in your post I consider this the only actual limitation of flakes…

your view a project based (where you know what and how you want to build up your idea) - stage 2

What I’m referring to is - stage 1 - an ad-hoc/dynamic environment where you test (and switch back and forth) out very different technologies and ways to get a fitting direction for the project

In my point of view those two states someone goes through while creating something new (perhaps complex) has quite different requirements (and flakes looks like [only] focused on the second stage at the moment)

nix-shell is not limited to shell.nix or default.nix (nix-shell hello_xy.nix works fine, right?)

In e.g. vscode I have > 5 flake.nix files open (so that I always have to get the path [which has to be short not shorten the tab itself …] not the file name …)

  • with nix-shell and proper file names that was very clear (with short tabs [individual file naming → not path added in the tab itself] … )

I don’t want to discuss about (good or bad) flakes here!
I would like to get to know if there are any workarounds to use flakes as it would be efficient for my work (and if not, I have to write some scripts to automate the boilerplate and arrange a new logic of handling the initial phase)

It’s not necessary to add flake.nix under version control, just add path:$PWD to your nix call, like this:

nix develop path:$PWD