From a38f8034de37a60694451d59e97f26e3c8efbcc6 Mon Sep 17 00:00:00 2001 From: fricklerhandwerk Date: Thu, 24 Mar 2022 18:44:48 +0100 Subject: [PATCH] update generated README --- README.md | 348 +++++++++++++----------------------- core/README.md | 31 +++- toolchains/cc/README.md | 231 ++++++++++++++++++++++++ toolchains/go/README.md | 232 ++++++++++++++++++++++++ toolchains/java/README.md | 311 ++++++++++++++++++++++++++++++++ toolchains/posix/README.md | 79 ++++++++ toolchains/python/README.md | 228 +++++++++++++++++++++++ toolchains/rust/README.md | 145 +++++++++++++++ 8 files changed, 1377 insertions(+), 228 deletions(-) create mode 100644 toolchains/go/README.md create mode 100644 toolchains/java/README.md create mode 100644 toolchains/posix/README.md create mode 100644 toolchains/python/README.md create mode 100644 toolchains/rust/README.md diff --git a/README.md b/README.md index 7f70f6da1..7038216d8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ - + + + # Nixpkgs rules for Bazel @@ -30,8 +32,9 @@ Links: * [nixpkgs_cc_configure_deprecated](#nixpkgs_cc_configure_deprecated) * [nixpkgs_java_configure](#nixpkgs_java_configure) * [nixpkgs_python_configure](#nixpkgs_python_configure) +* [nixpkgs_go_configure](toolchains/go/README.md#nixpkgs_go_configure) +* [nixpkgs_rust_configure](#nixpkgs_rust_configure) * [nixpkgs_sh_posix_configure](#nixpkgs_sh_posix_configure) -* [nixpkgs_go_configure](#nixpkgs_go_configure) ## Setup @@ -76,11 +79,35 @@ nixpkgs_package( ) ``` -## Rules +## Migration from older releases - +### `path` Attribute (removed in 0.3) + +`path` was an attribute from the early days of `rules_nixpkgs`, and +its ability to reference arbitrary paths is a danger to build hermeticity. -Rules for importing Nixpkgs packages. +Replace it with either `nixpkgs_git_repository` if you need +a specific version of `nixpkgs`. If you absolutely *must* depend on a +local folder, use Bazel's +[`local_repository` workspace rule](https://docs.bazel.build/versions/master/be/workspace.html#local_repository). +Both approaches work well with the `repositories` attribute of `nixpkgs_package`. + +```bzl +local_repository( + name = "local-nixpkgs", + path = "/path/to/nixpkgs", +) + +nixpkgs_package( + name = "somepackage", + repositories = { + "nixpkgs": "@local-nixpkgs//:default.nix", + }, +) +``` + + +# Reference documentation @@ -1327,22 +1354,16 @@ Constraints for the target platform. - + -### nixpkgs_sh_posix_configure +### nixpkgs_rust_configure
-nixpkgs_sh_posix_configure(name, packages, kwargs)
+nixpkgs_rust_configure(name, default_edition, repository, repositories, nix_file, nix_file_deps,
+                       nix_file_content, nixopts, fail_not_supported, quiet, exec_constraints,
+                       target_constraints)
 
-Create a POSIX toolchain from nixpkgs. - -Loads the given Nix packages, scans them for standard Unix tools, and -generates a corresponding `sh_posix_toolchain`. - -Make sure to call `nixpkgs_sh_posix_configure` before `sh_posix_configure`, -if you use both. Otherwise, the local toolchain will always be chosen in -favor of the nixpkgs one. #### Parameters @@ -1353,304 +1374,181 @@ favor of the nixpkgs one. - + name optional. -default is "nixpkgs_sh_posix_config" - -

- -Name prefix for the generated repositories. +default is "nixpkgs_rust" -

- -packages + +default_edition optional. -default is ["stdenv.initialPath"] - -

- -List of Nix attribute paths to draw Unix tools from. +default is "2018" -

- -kwargs + +repository optional. +default is None - - - - - - - - -Rules for importing a Go toolchain from Nixpkgs. - -**NOTE: The following rules must be loaded from -`@io_tweag_rules_nixpkgs//nixpkgs:toolchains/go.bzl` to avoid unnecessary -dependencies on rules_go for those who don't need go toolchain. -`io_bazel_rules_go` must be available for loading before loading of -`@io_tweag_rules_nixpkgs//nixpkgs:toolchains/go.bzl`.** - - - - -### nixpkgs_go_configure - -
-nixpkgs_go_configure(sdk_name, repository, repositories, nix_file, nix_file_deps, nix_file_content,
-                     nixopts, fail_not_supported, quiet)
-
- -Use go toolchain from Nixpkgs. - -By default rules_go configures the go toolchain to be downloaded as binaries (which doesn't work on NixOS). -There is a way to tell rules_go to look into environment and find local go binary which is not hermetic. -This command allows to setup a hermetic go sdk from Nixpkgs, which should be considered as best practice. -Cross toolchains are declared and registered for each entry in the `PLATFORMS` constant in `rules_go`. - -Note that the nix package must provide a full go sdk at the root of the package instead of in `$out/share/go`, -and also provide an empty normal file named `ROOT` at the root of package. - -#### Example - - ```bzl - nixpkgs_go_configure(repository = "@nixpkgs//:default.nix") - ``` - - Example (optional nix support when go is a transitive dependency): - - ```bzl - # .bazel-lib/nixos-support.bzl - def _has_nix(ctx): - return ctx.which("nix-build") != None - - def _gen_imports_impl(ctx): - ctx.file("BUILD", "") - - imports_for_nix = """ - load("@io_tweag_rules_nixpkgs//nixpkgs:toolchains/go.bzl", "nixpkgs_go_configure") - - def fix_go(): - nixpkgs_go_configure(repository = "@nixpkgs") - """ - imports_for_non_nix = """ - def fix_go(): - # if go isn't transitive you'll need to add call to go_register_toolchains here - pass - """ - - if _has_nix(ctx): - ctx.file("imports.bzl", imports_for_nix) - else: - ctx.file("imports.bzl", imports_for_non_nix) - - _gen_imports = repository_rule( - implementation = _gen_imports_impl, - attrs = dict(), - ) - - def gen_imports(): - _gen_imports( - name = "nixos_support", - ) - - # WORKSPACE - - // ... - http_archive(name = "io_tweag_rules_nixpkgs", ...) - // ... - local_repository( - name = "bazel_lib", - path = ".bazel-lib", - ) - load("@bazel_lib//:nixos-support.bzl", "gen_imports") - gen_imports() - load("@nixos_support//:imports.bzl", "fix_go") - fix_go() - ``` - - -#### Parameters - - ---- - - - + + - - + + - - + + - - + + + + + + - - + + + + + + - - + + - - + + - - + +
sdk_name
repositories optional. -default is "go_sdk" - -

- -Go sdk name to pass to rules_go +default is {} -

repository
nix_file optional. default is None -

- -A repository label identifying which Nixpkgs to use. Equivalent to `repositories = { "nixpkgs": ...}`. - -

repositories
nix_file_deps optional. -default is {} - -

- -A dictionary mapping `NIX_PATH` entries to repository labels. - - Setting it to - ``` - repositories = { "myrepo" : "//:myrepo" } - ``` - for example would replace all instances of `` in the called nix code by the path to the target `"//:myrepo"`. See the [relevant section in the nix manual](https://nixos.org/nix/manual/#env-NIX_PATH) for more information. - - Specify one of `path` or `repositories`. +default is None -

nix_file
nix_file_content optional. default is None -

+

nixopts -An expression for a Nix environment derivation. The environment should expose the whole go SDK (`bin`, `src`, ...) at the root of package. It also must contain a `ROOT` file in the root of pacakge. +optional. +default is [] -

nix_file_deps
fail_not_supported optional. -default is None +default is True -

+

quiet -Dependencies of `nix_file` if any. +optional. +default is False -

nix_file_content
exec_constraints optional. default is None -

- -An expression for a Nix environment derivation. - -

nixopts
target_constraints optional. -default is [] +default is None
fail_not_supported
+ + + + +### nixpkgs_sh_posix_configure + +
+nixpkgs_sh_posix_configure(name, packages, kwargs)
+
+ +Create a POSIX toolchain from nixpkgs. + +Loads the given Nix packages, scans them for standard Unix tools, and +generates a corresponding `sh_posix_toolchain`. + +Make sure to call `nixpkgs_sh_posix_configure` before `sh_posix_configure`, +if you use both. Otherwise, the local toolchain will always be chosen in +favor of the nixpkgs one. + + +#### Parameters + + ++++ + + + - - + + - -
name optional. -default is True +default is "nixpkgs_sh_posix_config"

-See [`nixpkgs_package`](#nixpkgs_package-fail_not_supported). +Name prefix for the generated repositories.

quiet
packages optional. -default is False +default is ["stdenv.initialPath"]

-Whether to hide the output of the Nix command. +List of Nix attribute paths to draw Unix tools from.

- - - - -## Migration from older releases - -### `path` Attribute (removed in 0.3) + +kwargs + -`path` was an attribute from the early days of `rules_nixpkgs`, and -its ability to reference arbitrary paths is a danger to build hermeticity. +optional. -Replace it with either `nixpkgs_git_repository` if you need -a specific version of `nixpkgs`. If you absolutely *must* depend on a -local folder, use Bazel’s -[`local_repository` workspace rule](https://docs.bazel.build/versions/master/be/workspace.html#local_repository). -Both approaches work well with the `repositories` attribute of `nixpkgs_package`. + + + + -```bzl -local_repository( - name = "local-nixpkgs", - path = "/path/to/nixpkgs", -) -nixpkgs_package( - name = "somepackage", - repositories = { - "nixpkgs": "@local-nixpkgs//:default.nix", - }, - … -) -``` diff --git a/core/README.md b/core/README.md index fcd14d527..609d8a390 100644 --- a/core/README.md +++ b/core/README.md @@ -1,10 +1,36 @@ -# Nixpkgs for Bazel + + + + +# Nixpkgs rules for Bazel + +[![Build status](https://badge.buildkite.com/79bd0a8aa1e47a92e0254ca3afe5f439776e6d389cfbde9d8c.svg?branch=master)](https://buildkite.com/tweag-1/rules-nixpkgs) + +Use [Nix][nix] and the [Nixpkgs][nixpkgs] package set to import +external dependencies (like system packages) into [Bazel][bazel] +hermetically. If the version of any dependency changes, Bazel will +correctly rebuild targets, and only those targets that use the +external dependencies that changed. + +Links: +* [Nix + Bazel = fully reproducible, incremental + builds][blog-bazel-nix] (blog post) +* [Nix + Bazel][youtube-bazel-nix] (lightning talk) + +[nix]: https://nixos.org/nix +[nixpkgs]: https://github.com/NixOS/nixpkgs +[bazel]: https://bazel.build +[blog-bazel-nix]: https://www.tweag.io/posts/2018-03-15-bazel-nix.html +[youtube-bazel-nix]: https://www.youtube.com/watch?v=hDdDUrty1Gw ## Rules - +* [nixpkgs_git_repository](#nixpkgs_git_repository) +* [nixpkgs_local_repository](#nixpkgs_local_repository) +* [nixpkgs_package](#nixpkgs_package) +# Reference documentation @@ -389,4 +415,3 @@ optional. - diff --git a/toolchains/cc/README.md b/toolchains/cc/README.md index e69de29bb..d22d4f86e 100644 --- a/toolchains/cc/README.md +++ b/toolchains/cc/README.md @@ -0,0 +1,231 @@ + + + + +Rules for importing a C++ toolchain from Nixpkgs. + +## Rules + +* [nixpkgs_cc_configure](#nixpkgs_cc_configure) + + +# Reference documentation + + + +### nixpkgs_cc_configure + +
+nixpkgs_cc_configure(name, attribute_path, nix_file, nix_file_content, nix_file_deps, repositories,
+                     repository, nixopts, quiet, fail_not_supported, exec_constraints,
+                     target_constraints, register)
+
+ +Use a CC toolchain from Nixpkgs. No-op if not a nix-based platform. + +By default, Bazel auto-configures a CC toolchain from commands (e.g. +`gcc`) available in the environment. To make builds more hermetic, use +this rule to specify explicitly which commands the toolchain should use. + +Specifically, it builds a Nix derivation that provides the CC toolchain +tools in the `bin/` path and constructs a CC toolchain that uses those +tools. Tools that aren't found are replaced by `${coreutils}/bin/false`. +You can inspect the resulting `@_info//:CC_TOOLCHAIN_INFO` to see +which tools were discovered. + +This rule depends on [`rules_cc`](https://github.com/bazelbuild/rules_cc). + +**Note:** +You need to configure `--crosstool_top=@//:toolchain` to activate +this toolchain. + + +#### Parameters + + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
name + +optional. +default is "local_config_cc" + +
attribute_path + +optional. +default is "" + +

+ +optional, string, Obtain the toolchain from the Nix expression under this attribute path. Requires `nix_file` or `nix_file_content`. + +

+
nix_file + +optional. +default is None + +

+ +optional, Label, Obtain the toolchain from the Nix expression defined in this file. Specify only one of `nix_file` or `nix_file_content`. + +

+
nix_file_content + +optional. +default is "" + +

+ +optional, string, Obtain the toolchain from the given Nix expression. Specify only one of `nix_file` or `nix_file_content`. + +

+
nix_file_deps + +optional. +default is [] + +

+ +optional, list of Label, Additional files that the Nix expression depends on. + +

+
repositories + +optional. +default is {} + +

+ +dict of Label to string, Provides `` and other repositories. Specify one of `repositories` or `repository`. + +

+
repository + +optional. +default is None + +

+ +Label, Provides ``. Specify one of `repositories` or `repository`. + +

+
nixopts + +optional. +default is [] + +

+ +optional, list of string, Extra flags to pass when calling Nix. Subject to location expansion, any instance of `$(location LABEL)` will be replaced by the path to the file ferenced by `LABEL` relative to the workspace root. + +

+
quiet + +optional. +default is False + +

+ +bool, Whether to hide `nix-build` output. + +

+
fail_not_supported + +optional. +default is True + +

+ +bool, Whether to fail if `nix-build` is not available. + +

+
exec_constraints + +optional. +default is None + +

+ +Constraints for the execution platform. + +

+
target_constraints + +optional. +default is None + +

+ +Constraints for the target platform. + +

+
register + +optional. +default is True + +

+ +bool, enabled by default, Whether to register (with `register_toolchains`) the generated toolchain and install it as the default cc_toolchain. + +

+
+ + diff --git a/toolchains/go/README.md b/toolchains/go/README.md new file mode 100644 index 000000000..3ed217445 --- /dev/null +++ b/toolchains/go/README.md @@ -0,0 +1,232 @@ + + + + +Rules for importing a Go toolchain from Nixpkgs. + +## Rules + +* [nixpkgs_go_configure](#nixpkgs_go_configure) + + +# Reference documentation + + + +### nixpkgs_go_configure + +
+nixpkgs_go_configure(sdk_name, repository, repositories, nix_file, nix_file_deps, nix_file_content,
+                     nixopts, fail_not_supported, quiet)
+
+ +Use go toolchain from Nixpkgs. + +By default rules_go configures the go toolchain to be downloaded as binaries (which doesn't work on NixOS). +There is a way to tell rules_go to look into environment and find local go binary which is not hermetic. +This command allows to setup a hermetic go sdk from Nixpkgs, which should be considered as best practice. +Cross toolchains are declared and registered for each entry in the `PLATFORMS` constant in `rules_go`. + +Note that the nix package must provide a full go sdk at the root of the package instead of in `$out/share/go`, +and also provide an empty normal file named `ROOT` at the root of package. + +#### Example + + ```bzl + nixpkgs_go_configure(repository = "@nixpkgs//:default.nix") + ``` + + Example (optional nix support when go is a transitive dependency): + + ```bzl + # .bazel-lib/nixos-support.bzl + def _has_nix(ctx): + return ctx.which("nix-build") != None + + def _gen_imports_impl(ctx): + ctx.file("BUILD", "") + + imports_for_nix = """ + load("@io_tweag_rules_nixpkgs//nixpkgs:toolchains/go.bzl", "nixpkgs_go_configure") + + def fix_go(): + nixpkgs_go_configure(repository = "@nixpkgs") + """ + imports_for_non_nix = """ + def fix_go(): + # if go isn't transitive you'll need to add call to go_register_toolchains here + pass + """ + + if _has_nix(ctx): + ctx.file("imports.bzl", imports_for_nix) + else: + ctx.file("imports.bzl", imports_for_non_nix) + + _gen_imports = repository_rule( + implementation = _gen_imports_impl, + attrs = dict(), + ) + + def gen_imports(): + _gen_imports( + name = "nixos_support", + ) + + # WORKSPACE + + // ... + http_archive(name = "io_tweag_rules_nixpkgs", ...) + // ... + local_repository( + name = "bazel_lib", + path = ".bazel-lib", + ) + load("@bazel_lib//:nixos-support.bzl", "gen_imports") + gen_imports() + load("@nixos_support//:imports.bzl", "fix_go") + fix_go() + ``` + + +#### Parameters + + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
sdk_name + +optional. +default is "go_sdk" + +

+ +Go sdk name to pass to rules_go + +

+
repository + +optional. +default is None + +

+ +A repository label identifying which Nixpkgs to use. Equivalent to `repositories = { "nixpkgs": ...}`. + +

+
repositories + +optional. +default is {} + +

+ +A dictionary mapping `NIX_PATH` entries to repository labels. + + Setting it to + ``` + repositories = { "myrepo" : "//:myrepo" } + ``` + for example would replace all instances of `` in the called nix code by the path to the target `"//:myrepo"`. See the [relevant section in the nix manual](https://nixos.org/nix/manual/#env-NIX_PATH) for more information. + + Specify one of `path` or `repositories`. + +

+
nix_file + +optional. +default is None + +

+ +An expression for a Nix environment derivation. The environment should expose the whole go SDK (`bin`, `src`, ...) at the root of package. It also must contain a `ROOT` file in the root of pacakge. + +

+
nix_file_deps + +optional. +default is None + +

+ +Dependencies of `nix_file` if any. + +

+
nix_file_content + +optional. +default is None + +

+ +An expression for a Nix environment derivation. + +

+
nixopts + +optional. +default is [] + +
fail_not_supported + +optional. +default is True + +

+ +See [`nixpkgs_package`](#nixpkgs_package-fail_not_supported). + +

+
quiet + +optional. +default is False + +

+ +Whether to hide the output of the Nix command. + +

+
+ + diff --git a/toolchains/java/README.md b/toolchains/java/README.md new file mode 100644 index 000000000..5886ee5f1 --- /dev/null +++ b/toolchains/java/README.md @@ -0,0 +1,311 @@ + + + + +# Rules for importing a Java toolchain from Nixpkgs + +## Rules + +* [nixpkgs_java_configure](#nixpkgs_java_configure) + + +# Reference documentation + + + +### nixpkgs_java_configure + +
+nixpkgs_java_configure(name, attribute_path, java_home_path, repository, repositories, nix_file,
+                       nix_file_content, nix_file_deps, nixopts, fail_not_supported, quiet, toolchain,
+                       toolchain_name, toolchain_version, exec_constraints, target_constraints)
+
+ +Define a Java runtime provided by nixpkgs. + +Creates a `nixpkgs_package` for a `java_runtime` instance. Optionally, +you can also create & register a Java toolchain. This only works with Bazel >= 5.0 +Bazel can use this instance to run JVM binaries and tests, refer to the +[Bazel documentation](https://docs.bazel.build/versions/4.0.0/bazel-and-java.html#configuring-the-jdk) for details. + +#### Example + +##### Bazel 4 + +Add the following to your `WORKSPACE` file to import a JDK from nixpkgs: +```bzl +load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_java_configure") +nixpkgs_java_configure( + attribute_path = "jdk11.home", + repository = "@nixpkgs", +) +``` + +Add the following configuration to `.bazelrc` to enable this Java runtime: +``` +build --javabase=@nixpkgs_java_runtime//:runtime +build --host_javabase=@nixpkgs_java_runtime//:runtime +# Adjust this to match the Java version provided by this runtime. +# See `bazel query 'kind(java_toolchain, @bazel_tools//tools/jdk:all)'` for available options. +build --java_toolchain=@bazel_tools//tools/jdk:toolchain_java11 +build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_java11 +``` + +##### Bazel 5 + +Add the following to your `WORKSPACE` file to import a JDK from nixpkgs: +```bzl +load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_java_configure") +nixpkgs_java_configure( + attribute_path = "jdk11.home", + repository = "@nixpkgs", + toolchain = True, + toolchain_name = "nixpkgs_java", + toolchain_version = "11", +) +``` + +Add the following configuration to `.bazelrc` to enable this Java runtime: +``` +build --host_platform=@io_tweag_rules_nixpkgs//nixpkgs/platforms:host +build --java_runtime_version=nixpkgs_java +build --tool_java_runtime_version=nixpkgs_java +``` + + +#### Parameters + + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
name + +optional. +default is "nixpkgs_java_runtime" + +

+ +The name-prefix for the created external repositories. + +

+
attribute_path + +optional. +default is None + +

+ +string, The nixpkgs attribute path for `jdk.home`. + +

+
java_home_path + +optional. +default is "" + +

+ +optional, string, The path to `JAVA_HOME` within the package. + +

+
repository + +optional. +default is None + +

+ +See [`nixpkgs_package`](#nixpkgs_package-repository). + +

+
repositories + +optional. +default is {} + +

+ +See [`nixpkgs_package`](#nixpkgs_package-repositories). + +

+
nix_file + +optional. +default is None + +

+ +optional, Label, Obtain the runtime from the Nix expression defined in this file. Specify only one of `nix_file` or `nix_file_content`. + +

+
nix_file_content + +optional. +default is "" + +

+ +optional, string, Obtain the runtime from the given Nix expression. Specify only one of `nix_file` or `nix_file_content`. + +

+
nix_file_deps + +optional. +default is None + +

+ +See [`nixpkgs_package`](#nixpkgs_package-nix_file_deps). + +

+
nixopts + +optional. +default is [] + +

+ +See [`nixpkgs_package`](#nixpkgs_package-nixopts). + +

+
fail_not_supported + +optional. +default is True + +

+ +See [`nixpkgs_package`](#nixpkgs_package-fail_not_supported). + +

+
quiet + +optional. +default is False + +

+ +See [`nixpkgs_package`](#nixpkgs_package-quiet). + +

+
toolchain + +optional. +default is False + +

+ +Create & register a Bazel toolchain based on the Java runtime. + +

+
toolchain_name + +optional. +default is None + +

+ +The name of the toolchain that can be used in --java_runtime_version. + +

+
toolchain_version + +optional. +default is None + +

+ +The version of the toolchain that can be used in --java_runtime_version. + +

+
exec_constraints + +optional. +default is None + +

+ +Constraints for the execution platform. + +

+
target_constraints + +optional. +default is None + +

+ +Constraints for the target platform. + +

+
+ + diff --git a/toolchains/posix/README.md b/toolchains/posix/README.md new file mode 100644 index 000000000..28a3c0e0b --- /dev/null +++ b/toolchains/posix/README.md @@ -0,0 +1,79 @@ + + + + +Rules for importing a POSIX toolchain from Nixpkgs. + +# Rules + +* [nixpkgs_sh_posix_configure](#nixpkgs_sh_posix_configure) + + +# Reference documentation + + + +### nixpkgs_sh_posix_configure + +
+nixpkgs_sh_posix_configure(name, packages, kwargs)
+
+ +Create a POSIX toolchain from nixpkgs. + +Loads the given Nix packages, scans them for standard Unix tools, and +generates a corresponding `sh_posix_toolchain`. + +Make sure to call `nixpkgs_sh_posix_configure` before `sh_posix_configure`, +if you use both. Otherwise, the local toolchain will always be chosen in +favor of the nixpkgs one. + + +#### Parameters + + ++++ + + + + + + + + + + + + + + +
name + +optional. +default is "nixpkgs_sh_posix_config" + +

+ +Name prefix for the generated repositories. + +

+
packages + +optional. +default is ["stdenv.initialPath"] + +

+ +List of Nix attribute paths to draw Unix tools from. + +

+
kwargs + +optional. + +
+ + diff --git a/toolchains/python/README.md b/toolchains/python/README.md new file mode 100644 index 000000000..cb4db14d7 --- /dev/null +++ b/toolchains/python/README.md @@ -0,0 +1,228 @@ + + + + +Rules for importing a Python toolchain from Nixpkgs. + +# Rules + +* [nixpkgs_python_configure](#nixpkgs_python_configure) + + +# Reference documentation + + + +### nixpkgs_python_configure + +
+nixpkgs_python_configure(name, python2_attribute_path, python2_bin_path, python3_attribute_path,
+                         python3_bin_path, repository, repositories, nix_file_deps, nixopts,
+                         fail_not_supported, quiet, exec_constraints, target_constraints)
+
+ +Define and register a Python toolchain provided by nixpkgs. + +Creates `nixpkgs_package`s for Python 2 or 3 `py_runtime` instances and a +corresponding `py_runtime_pair` and `toolchain`. The toolchain is +automatically registered and uses the constraint: + +``` +"@io_tweag_rules_nixpkgs//nixpkgs/constraints:support_nix" +``` + + +#### Parameters + + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
name + +optional. +default is "nixpkgs_python_toolchain" + +

+ +The name-prefix for the created external repositories. + +

+
python2_attribute_path + +optional. +default is None + +

+ +The nixpkgs attribute path for python2. + +

+
python2_bin_path + +optional. +default is "bin/python" + +

+ +The path to the interpreter within the package. + +

+
python3_attribute_path + +optional. +default is "python3" + +

+ +The nixpkgs attribute path for python3. + +

+
python3_bin_path + +optional. +default is "bin/python" + +

+ +The path to the interpreter within the package. + +

+
repository + +optional. +default is None + +

+ +See [`nixpkgs_package`](#nixpkgs_package-repository). + +

+
repositories + +optional. +default is {} + +

+ +See [`nixpkgs_package`](#nixpkgs_package-repositories). + +

+
nix_file_deps + +optional. +default is None + +

+ +See [`nixpkgs_package`](#nixpkgs_package-nix_file_deps). + +

+
nixopts + +optional. +default is [] + +

+ +See [`nixpkgs_package`](#nixpkgs_package-nixopts). + +

+
fail_not_supported + +optional. +default is True + +

+ +See [`nixpkgs_package`](#nixpkgs_package-fail_not_supported). + +

+
quiet + +optional. +default is False + +

+ +See [`nixpkgs_package`](#nixpkgs_package-quiet). + +

+
exec_constraints + +optional. +default is None + +

+ +Constraints for the execution platform. + +

+
target_constraints + +optional. +default is None + +

+ +Constraints for the target platform. + +

+
+ + diff --git a/toolchains/rust/README.md b/toolchains/rust/README.md new file mode 100644 index 000000000..fe9a9595c --- /dev/null +++ b/toolchains/rust/README.md @@ -0,0 +1,145 @@ + + + + +Rules for importing a Rust toolchain from Nixpkgs. + +# Rules + +* [nixpkgs_rust_configure](#nixpkgs_rust_configure) + + +# Reference documentation + + + +### nixpkgs_rust_configure + +
+nixpkgs_rust_configure(name, default_edition, repository, repositories, nix_file, nix_file_deps,
+                       nix_file_content, nixopts, fail_not_supported, quiet, exec_constraints,
+                       target_constraints)
+
+ + + +#### Parameters + + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
name + +optional. +default is "nixpkgs_rust" + +
default_edition + +optional. +default is "2018" + +
repository + +optional. +default is None + +
repositories + +optional. +default is {} + +
nix_file + +optional. +default is None + +
nix_file_deps + +optional. +default is None + +
nix_file_content + +optional. +default is None + +
nixopts + +optional. +default is [] + +
fail_not_supported + +optional. +default is True + +
quiet + +optional. +default is False + +
exec_constraints + +optional. +default is None + +
target_constraints + +optional. +default is None + +
+ +