Skip to content

Parse documented Nix flake input forms #94

Description

@andrew

The current flake.nix parser recognizes literal URL declarations written as name.url = "..." or name = { url = "..."; }. It returns no dependencies for the documented attribute-set form:

{
  inputs.import-cargo = {
    type = "github";
    owner = "edolstra";
    repo = "import-cargo";
  };

  outputs = { self, import-cargo }: {};
}

Parsing this through manifests.Parse("flake.nix", content) should return a direct dependency for import-cargo. The current result has an empty dependency list.

Support the attribute-set and URL-like forms described in the Nix flake input format. Account for indirect registry inputs, nested overrides, and follows relationships. Inputs declared only as outputs parameters are documented as equivalent to indirect registry inputs, so their treatment also needs an explicit choice and tests.

The parser should restrict extraction to the inputs attribute. Its current regexes scan the whole file after any occurrence of the word inputs.

Nix documents that flake inputs and metadata fields cannot be arbitrary Nix expressions, so a static syntax parser can read these fields without evaluating outputs.

Related consumer request: ecosyste-ms/parser#1199

Observed on git-pkgs/manifests main at a49fb29d74c7724ded24ee1d505319c1d9073395.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions