Skip to content

Comments

Create core module extensions#363

Merged
mergify[bot] merged 13 commits intomasterfrom
bzlmod
Apr 5, 2023
Merged

Create core module extensions#363
mergify[bot] merged 13 commits intomasterfrom
bzlmod

Conversation

@aherrmann
Copy link
Contributor

Implements part of #183.
It's a relatively large change-set and probably easiest reviewed commit by commit. Refer to the commit messages for additional information.

  • Refines the module extension design document based on an offlie discussion around the automated use_repo and a potential future use_local_repo proposal. The relevant outcome is that repositories should either be global or scoped per module and the repository names should reflect this. Additionally, this simplivies overrides and removes the import_name attribute.
  • Defines a helper module for hub repositories to factor out commonly needed functionality for nix_repo and nix_pkg generated hub repositories.
  • Adds unit tests for the module registry.
  • Implements module extensions for Nix repositories and Nix packages, with default, github, and override tags for nix_repo, and attr and local_attr tags for nix_pkg. Remaining tags will be implemented later.
  • Updates testing/core to use the nix_repo and nix_pkg module extensions where already feasible.
  • Includes compatibility stubs for WORKSPACE mode.

- Update the requirements and design based on the discussion on
  `use_repo` and a potential future `use_local_repo`. Accordingly, we
  should strive to generate external repositories under two different
  kinds of names:
  - Either globally valid, and in that case not mangled. These may later
    be imported directly using the automated `use_repo` proposal
  - Or only locally valid in the requesting module, and in that case
    mangled by module name and version prefix. These may later be
    imported directly using the automated `use_local_repo` idea.
- Simplify the notion of overrides.
  - Bazel already has builtin features that support per module
    overrides, such as `local_path_override`. In the spirit of
    composability and reuse we shouldn't reimplement this functionality.
  - Limit the provided functionality to global overrides as those cannot
    easily be replicated with Bazel's builtin features.
- Remove the `import_name` attribute and instead use the same approach
  as `nixpkgs_package`. The `NIX_PATH` is really a `nix-build` site
  concern.
- Shorten the attribute names.
- Avoid the `global` identifier, it's a reserved keyword.
To factor out the commonly needed functionality for the `nix_repo` and
`nix_pkg` generated hub repositories and others for toolchains later on.
@aherrmann aherrmann requested a review from benradf as a code owner April 3, 2023 09:16
Copy link
Contributor

@benradf benradf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@aherrmann aherrmann added the merge-queue merge on green CI label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants