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

extract bzlmod modules for core rules and toolchains #193

Merged
merged 25 commits into from
Mar 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
0abb1a5
move core `nixpkgs` rules to separate module
fricklerhandwerk Mar 7, 2022
389f8c3
docs generation: reset record separator after match
fricklerhandwerk Mar 7, 2022
7268ea3
README: fix typos
fricklerhandwerk Mar 7, 2022
d19f882
generate separate README for core module
fricklerhandwerk Mar 7, 2022
7f91de8
move utilities to core module
fricklerhandwerk Mar 7, 2022
b143b59
extract go toolchain into separate module
fricklerhandwerk Mar 8, 2022
6073204
make `rules_nixpkgs_core` independent repository
fricklerhandwerk Mar 8, 2022
2f6b91f
extract python toolchain into module
fricklerhandwerk Mar 9, 2022
8891efa
extract java toolchain into module
fricklerhandwerk Mar 9, 2022
b08b196
extract CC toolchain into module
fricklerhandwerk Mar 9, 2022
f525a13
split long sentence
fricklerhandwerk Mar 9, 2022
972299e
add notes on aliases to aid migration
fricklerhandwerk Mar 9, 2022
8297cec
extract Rust toolchain into module
fricklerhandwerk Mar 9, 2022
6aa5eb6
wrap Java toolchain in workspace
fricklerhandwerk Mar 9, 2022
95e8986
wrap Python toolchain in workspace
fricklerhandwerk Mar 10, 2022
22dbd3c
fix sandboxed integration test
fricklerhandwerk Mar 9, 2022
add02d1
move constraints definitions into `core`
fricklerhandwerk Mar 10, 2022
5819e1d
add module dependencies where possible
fricklerhandwerk Mar 10, 2022
a792c43
extract POSIX toolchain into module
fricklerhandwerk Mar 10, 2022
b1d493e
move `BUILD.pkg` template to `core`
fricklerhandwerk Mar 10, 2022
d06eafc
fix comment typo
fricklerhandwerk Mar 14, 2022
885708a
generalize scripts to generate documentation
fricklerhandwerk Mar 14, 2022
29bae9a
import sub-repositories based on original import type
fricklerhandwerk Mar 15, 2022
610d6eb
prepare reference docs generation for each submodule
fricklerhandwerk Mar 15, 2022
b4967da
add rendered documentation for Java
fricklerhandwerk Mar 15, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ load("@io_tweag_rules_nixpkgs//nixpkgs:nixpkgs.bzl", "nixpkgs_git_repository", "
load("@io_tweag_rules_nixpkgs//nixpkgs:toolchains/go.bzl", "nixpkgs_go_configure") # optional
```

If you use `rules_nixpkgs` to configure a toolchain then you will also need to
If you use `rules_nixpkgs` to configure a toolchain, then you will also need to
configure the build platform to include the
`@io_tweag_rules_nixpkgs//nixpkgs/constraints:support_nix` constraint. For
example by adding the following to `.bazelrc`:
Expand Down Expand Up @@ -1394,6 +1394,7 @@ optional.




<!-- Generated with Stardoc: http://skydoc.bazel.build -->

Rules for importing a Go toolchain from Nixpkgs.
Expand All @@ -1416,8 +1417,8 @@ nixpkgs_go_configure(<a href="#nixpkgs_go_configure-sdk_name">sdk_name</a>, <a h

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.
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`.

Expand Down Expand Up @@ -1625,3 +1626,31 @@ Whether to hide the output of the Nix command.




## 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.

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",
},
)
```
33 changes: 33 additions & 0 deletions core/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

package(default_visibility = ["//visibility:public"])

exports_files([
"nixpkgs.bzl",
])

filegroup(
name = "srcs",
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)

bzl_library(
name = "bazel_tools",
srcs = [
"@bazel_tools//tools:bzl_srcs",
],
)

bzl_library(
name = "core",
srcs = [
"nixpkgs.bzl",
"util.bzl",
],
visibility = ["//visibility:public"],
deps = [
":bazel_tools",
"@bazel_skylib//lib:paths",
],
)
File renamed without changes.
7 changes: 7 additions & 0 deletions core/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module(
name = "rules_nixpkgs_core",
version = "0.8.1",
)

bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "bazel_skylib", version = "1.0.3")
Loading