WIP: Generalize the fetcher registry to not be flake specific#9085
WIP: Generalize the fetcher registry to not be flake specific#9085Ericson2314 wants to merge 1 commit intoNixOS:masterfrom
Conversation
```
$ git grep -i flake src/libfetchers/
src/libfetchers/fetch-settings.hh: Example `~/code/flake.nix`:
src/libfetchers/fetch-settings.hh: Setting<bool> acceptFlakeConfig{this, false, "accept-flake-config",
src/libfetchers/fetch-settings.hh: "Whether to accept nix configuration from a flake without prompting.",
src/libfetchers/fetch-settings.hh: {}, true, Xp::Flakes};
src/libfetchers/fetch-settings.hh: The commit summary to use when committing changed flake lock files. If
src/libfetchers/fetch-settings.hh: {}, true, Xp::Flakes};
src/libfetchers/fetchers.cc: // usages (e.g. `builtins.fetchTree` calls or flake inputs).
src/libfetchers/indirect.cc:std::regex flakeRegex("[a-zA-Z][a-zA-Z0-9_-]*", std::regex::ECMAScript);
src/libfetchers/indirect.cc: if (url.scheme != "flake") return {};
src/libfetchers/indirect.cc: if (!std::regex_match(id, flakeRegex))
src/libfetchers/indirect.cc: if (!std::regex_match(id, flakeRegex))
src/libfetchers/indirect.cc: url.scheme = "flake";
src/libfetchers/registry.cc: for (auto & i : json["flakes"]) {
src/libfetchers/registry.cc: json["flakes"] = std::move(arr);
src/libfetchers/tarball.cc: // FIXME: would be nice to support arbitrary flakerefs
src/libfetchers/tarball.cc: // here, e.g. git flakes
```
|
I see what you mean, and it makes sense to me. Probably some instances can be reduced to just "registry". The term "fetcher" is very close to how the implementation thinks of itself, though. If this is the general direction we want to move towards, we should probably find a suitable name for what I currently call "remote file system trees", because that's what the registry is for (it's only used by "fetchers", the thingies that fetch the trees). This is a concept that pops up quite often, but we don't have a good name for it AFAIK. |
|
Yeah I agree |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
In #9063 (comment) @edolstra said these features are not actually Flake-specific. Here is an extremely crude attempt to rename things / change error messages to make that be the case. However there are a few "flake" left I am not sure how to deal with:
I don't really know how this feature works and therefore what does or doesn't make sense to change, so I will need some help with this.
Priorities
Add 👍 to pull requests you find important.