Skip to content

Commit

Permalink
Update the template
Browse files Browse the repository at this point in the history
  • Loading branch information
cgrindel committed Nov 28, 2023
1 parent 18e0295 commit 9c7a386
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Nixpkgs rules for Bazel

[![Continuous integration](https://github.com/tweag/rules_nixpkgs/actions/workflows/workflow.yaml/badge.svg)](https://github.com/tweag/rules_nixpkgs/actions/workflows/workflow.yaml)
[![Continuous integration](https://github.com/tweag/rules_nixpkgs/actions/workflows/workflow.yaml/badge.svg?event=schedule)](https://github.com/tweag/rules_nixpkgs/actions/workflows/workflow.yaml)

Use [Nix][nix] and the [Nixpkgs][nixpkgs] package set to import
external dependencies (like system packages) into [Bazel][bazel]
Expand Down
52 changes: 26 additions & 26 deletions core/nixpkgs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Nixpkgs rules for Bazel
[![Continuous integration](https://github.com/tweag/rules_nixpkgs/actions/workflows/workflow.yaml/badge.svg)](https://github.com/tweag/rules_nixpkgs/actions/workflows/workflow.yaml)
[![Continuous integration](https://github.com/tweag/rules_nixpkgs/actions/workflows/workflow.yaml/badge.svg?event=schedule)](https://github.com/tweag/rules_nixpkgs/actions/workflows/workflow.yaml)
Use [Nix][nix] and the [Nixpkgs][nixpkgs] package set to import
external dependencies (like system packages) into [Bazel][bazel]
Expand Down Expand Up @@ -85,16 +85,16 @@ def _nixpkgs_http_repository_impl(repository_ctx):
_nixpkgs_http_repository = repository_rule(
implementation = _nixpkgs_http_repository_impl,
attrs = {
"auth": attr.string_dict(),
"integrity": attr.string(),
"sha256": attr.string(),
"strip_prefix": attr.string(),
# The workspace name as specified by the user. Needed for bzlmod
# compatibility, as other means of retrieving the name only return the
# mangled name, not the user defined name.
"unmangled_name": attr.string(mandatory = True),
"url": attr.string(),
"urls": attr.string_list(),
"auth": attr.string_dict(),
"strip_prefix": attr.string(),
"integrity": attr.string(),
"sha256": attr.string(),
},
)

Expand Down Expand Up @@ -326,14 +326,14 @@ import nixpkgs
_nixpkgs_local_repository = repository_rule(
implementation = _nixpkgs_local_repository_impl,
attrs = {
"nix_file": attr.label(allow_single_file = [".nix"]),
"nix_file_content": attr.string(),
"nix_file_deps": attr.label_list(),
"nix_flake_lock_file": attr.label(allow_single_file = [".lock"]),
# The workspace name as specified by the user. Needed for bzlmod
# compatibility, as other means of retrieving the name only return the
# mangled name, not the user defined name.
"unmangled_name": attr.string(mandatory = True),
"nix_file": attr.label(allow_single_file = [".nix"]),
"nix_file_deps": attr.label_list(),
"nix_file_content": attr.string(),
"nix_flake_lock_file": attr.label(allow_single_file = [".lock"]),
},
)

Expand Down Expand Up @@ -591,23 +591,23 @@ def _nixpkgs_package_impl(repository_ctx):
_nixpkgs_package = repository_rule(
implementation = _nixpkgs_package_impl,
attrs = {
# The workspace name as specified by the user. Needed for bzlmod
# compatibility, as other means of retrieving the name only return the
# mangled name, not the user defined name.
"unmangled_name": attr.string(mandatory = True),
"attribute_path": attr.string(),
"nix_file": attr.label(allow_single_file = [".nix"]),
"nix_file_deps": attr.label_keyed_string_dict(),
"nix_file_content": attr.string(),
"repositories": attr.label_keyed_string_dict(),
"repository": attr.label(),
"build_file": attr.label(),
"build_file_content": attr.string(),
"nixopts": attr.string_list(),
"quiet": attr.bool(),
"fail_not_supported": attr.bool(default = True, doc = """
If set to True (default) this rule will fail on platforms which do not support Nix (e.g. Windows). If set to False calling this rule will succeed but no output will be generated.
"""),
"nix_file": attr.label(allow_single_file = [".nix"]),
"nix_file_content": attr.string(),
"nix_file_deps": attr.label_keyed_string_dict(),
"nixopts": attr.string_list(),
"quiet": attr.bool(),
"repositories": attr.label_keyed_string_dict(),
"repository": attr.label(),
# The workspace name as specified by the user. Needed for bzlmod
# compatibility, as other means of retrieving the name only return the
# mangled name, not the user defined name.
"unmangled_name": attr.string(mandatory = True),
},
)

Expand Down Expand Up @@ -795,18 +795,18 @@ def _nixpkgs_flake_package_impl(repository_ctx):
_nixpkgs_flake_package = repository_rule(
implementation = _nixpkgs_flake_package_impl,
attrs = {
"nix_flake_file": attr.label(mandatory = True, allow_single_file = ["flake.nix"]),
"nix_flake_lock_file": attr.label(mandatory = True, allow_single_file = ["flake.lock"]),
"nix_flake_file_deps": attr.label_keyed_string_dict(),
"package": attr.string(doc = "Defaults to `default`"),
"build_file": attr.label(),
"build_file_content": attr.string(),
"nixopts": attr.string_list(),
"quiet": attr.bool(),
"fail_not_supported": attr.bool(default = True, doc = """
If set to True (default) this rule will fail on platforms which do not support Nix (e.g. Windows). If set to False calling this rule will succeed but no output will be generated.
"""),
"legacy_path_syntax": attr.bool(default = False),
"nix_flake_file": attr.label(mandatory = True, allow_single_file = ["flake.nix"]),
"nix_flake_file_deps": attr.label_keyed_string_dict(),
"nix_flake_lock_file": attr.label(mandatory = True, allow_single_file = ["flake.lock"]),
"nixopts": attr.string_list(),
"package": attr.string(doc = "Defaults to `default`"),
"quiet": attr.bool(),
},
)

Expand Down
32 changes: 16 additions & 16 deletions nixpkgs/nixpkgs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Nixpkgs rules for Bazel
[![Continuous integration](https://github.com/tweag/rules_nixpkgs/actions/workflows/workflow.yaml/badge.svg)](https://github.com/tweag/rules_nixpkgs/actions/workflows/workflow.yaml)
[![Continuous integration](https://github.com/tweag/rules_nixpkgs/actions/workflows/workflow.yaml/badge.svg?event=schedule)](https://github.com/tweag/rules_nixpkgs/actions/workflows/workflow.yaml)
Use [Nix][nix] and the [Nixpkgs][nixpkgs] package set to import
external dependencies (like system packages) into [Bazel][bazel]
Expand Down Expand Up @@ -113,10 +113,15 @@ nixpkgs_package(
```
"""

load("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_autoconf_impl")
load(
"@bazel_tools//tools/cpp:lib_cc_configure.bzl",
"get_cpu_value",
)
load(
"@rules_nixpkgs_cc//:cc.bzl",
_nixpkgs_cc_configure = "nixpkgs_cc_configure",
)
load(
"@rules_nixpkgs_core//:nixpkgs.bzl",
_nixpkgs_flake_package = "nixpkgs_flake_package",
Expand All @@ -125,38 +130,33 @@ load(
_nixpkgs_local_repository = "nixpkgs_local_repository",
_nixpkgs_package = "nixpkgs_package",
)
load("@bazel_tools//tools/cpp:cc_configure.bzl", "cc_autoconf_impl")
load(
"@rules_nixpkgs_core//:util.bzl",
"execute_or_fail",
"find_children",
"is_supported_platform",
)
load(
"@rules_nixpkgs_python//:python.bzl",
_nixpkgs_python_configure = "nixpkgs_python_configure",
_nixpkgs_python_repository = "nixpkgs_python_repository",
)
load(
"@rules_nixpkgs_java//:java.bzl",
_nixpkgs_java_configure = "nixpkgs_java_configure",
)
load(
"@rules_nixpkgs_cc//:cc.bzl",
_nixpkgs_cc_configure = "nixpkgs_cc_configure",
)
load(
"@rules_nixpkgs_rust//:rust.bzl",
_nixpkgs_rust_configure = "nixpkgs_rust_configure",
"@rules_nixpkgs_nodejs//:nodejs.bzl",
_nixpkgs_nodejs_configure = "nixpkgs_nodejs_configure",
_nixpkgs_nodejs_configure_platforms = "nixpkgs_nodejs_configure_platforms",
)
load(
"@rules_nixpkgs_posix//:posix.bzl",
_nixpkgs_sh_posix_configure = "nixpkgs_sh_posix_configure",
)
load(
"@rules_nixpkgs_nodejs//:nodejs.bzl",
_nixpkgs_nodejs_configure = "nixpkgs_nodejs_configure",
_nixpkgs_nodejs_configure_platforms = "nixpkgs_nodejs_configure_platforms",
"@rules_nixpkgs_python//:python.bzl",
_nixpkgs_python_configure = "nixpkgs_python_configure",
_nixpkgs_python_repository = "nixpkgs_python_repository",
)
load(
"@rules_nixpkgs_rust//:rust.bzl",
_nixpkgs_rust_configure = "nixpkgs_rust_configure",
)

# aliases for backwards compatibility prior to `bzlmod`
Expand Down

0 comments on commit 9c7a386

Please sign in to comment.