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

Split rules_nixpkgs into separate components #182

Closed
Tracked by #181
aherrmann opened this issue Jan 28, 2022 · 0 comments · Fixed by #193
Closed
Tracked by #181

Split rules_nixpkgs into separate components #182

aherrmann opened this issue Jan 28, 2022 · 0 comments · Fixed by #193
Labels
P2 major: an upcoming release type: feature request

Comments

@aherrmann
Copy link
Member

Requirement of #181

Is your feature request related to a problem? Please describe.

The new bzlmod dependency management requires rule sets to declare all their direct dependencies upfront.
rules_nixpkgs is in the situation that it depends on many other rule sets. In principle, it could depend on every Bazel extension that provides a compiler toolchain like rules_cc, rules_go, rules_python, etc.

Before bzlmod this was not a problem, because dependencies were lazy - in the sense that e.g. nixpkgs_go_configure depends on rules_go, but a user only needs to worry about that dependency when they actually load @io_tweag_rules_nixpkgs//nixpkgs:toolchains/go.bzl.

With bzlmod all these dependencies need to be declared upfront in the MODULE.bazel file with version constraints. Meaning, rules_nixpkgs, as is, would introduce a large set of transitive dependencies for any of its users.

This is problematic as it could unnecessarily inflate the set of transitive dependencies of a project using rules_nixpkgs and expose users to version conflicts in transitive dependencies that they don't even want to use. It's also problematic as it would block modularization of rules_nixpkgs until all of its dependencies have been successfully modularized.

Describe the solution you'd like

The issue can be avoided by splitting rules_nixpkgs into separate Bazel modules, one for every language integration.

This could take the following form:

  • rules_nixpkgs_core:
    Defines nixpkgs_git_repository, nixpkgs_local_repository, and nixpkgs_package;
    and exposes other common functionality.
  • rules_nixpkgs_cc:
    Defines nixpkgs_cc_configure, etc.
  • rules_nixpkgs_java:
    Defines nixpkgs_java_configure.
  • etc.
  • We can keep a top-level rules_nixpkgs that re-exposes all these components for compatibility with the legacy non-bzlmod workflow.

Note, the intent is not to create separate Git repositories for all these components - this should not be necessary. It should still be possible to maintain all these components within the same Git repository.

@aherrmann aherrmann added the P2 major: an upcoming release label Feb 8, 2022
@fricklerhandwerk fricklerhandwerk self-assigned this Mar 4, 2022
@mergify mergify bot closed this as completed in #193 Mar 15, 2022
cbley-da added a commit to digital-asset/daml that referenced this issue May 6, 2022
Since [rules_nixpkgs#191] has been merged, we can drop the haskell-arm-m1.patch from rules_nixpkgs.

Also, rules_nixpkgs has been split into several components which need to be
added explicitly in `deps.bzl`, see [#182].

[#191]: tweag/rules_nixpkgs#191
[#182]: tweag/rules_nixpkgs#182
cbley-da added a commit to digital-asset/daml that referenced this issue May 6, 2022
Since [rules_nixpkgs#191] has been merged, we can drop the `rules-nixpkgs-arm.patch` from rules_nixpkgs.

Also, rules_nixpkgs has been split into several components which need to be
added explicitly in `deps.bzl`, see [#182].

[#191]: tweag/rules_nixpkgs#191
[#182]: tweag/rules_nixpkgs#182
cbley-da added a commit to digital-asset/daml that referenced this issue May 10, 2022
…3798)

* Update `rules_nixpgks` to HEAD

Since [rules_nixpkgs#191] has been merged, we can drop the `rules-nixpkgs-arm.patch` from rules_nixpkgs.

Also, rules_nixpkgs has been split into several components which need to be
added explicitly in `deps.bzl`, see [#182].

[#191]: tweag/rules_nixpkgs#191
[#182]: tweag/rules_nixpkgs#182

* Adapt `compatibility/deps.bzl`

* Update platforms repository to version 0.0.4

It has been updated in rules_nixpkgs, so this just follows suite.

* Pass through `isClang` attribute for the cc-toolchain

In rules_nixpkgs, this attribute is now used to determine whether the compiler is clang, see [#216].

[#216]: tweag/rules_nixpkgs#216

CHANGELOG_BEGIN
CHANGELOG_END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 major: an upcoming release type: feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants