Skip to content
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

WIP: Generalize the fetcher registry to not be flake specific #9085

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ericson2314
Copy link
Member

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:

$ 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 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.

```
$ 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
```
@github-actions github-actions bot added the fetching Networking with the outside (non-Nix) world, input locking label Oct 2, 2023
@Ericson2314 Ericson2314 marked this pull request as draft October 2, 2023 14:40
@Ericson2314 Ericson2314 changed the title WIP: generalize the fetcher registry to not be flake specific WIP: Generalize the fetcher registry to not be flake specific Oct 2, 2023
@fricklerhandwerk
Copy link
Contributor

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.

@Ericson2314
Copy link
Member Author

Yeah I agree fetcher-registry is not a good name; we're not registering fetchers themselves with it. I am not sure I know this feature well enough to come up with the right name.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/announcing-flakestry-dev-new-registry-for-flakes/34583/6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fetching Networking with the outside (non-Nix) world, input locking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants