Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Nov 15, 2023
2 parents ae42813 + d2112c2 commit 6915e95
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 15 deletions.
9 changes: 5 additions & 4 deletions .bcr/core/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ bcr_test_module:
run_tests:
name: "Run test module"
platform: ${{ platform }}
environment:
# The Nix installer updates ~/.profile to set PATH. However, the Bazel
# CI setup seems to disregard ~/.profile. So we set PATH manually here.
PATH: /var/lib/buildkite-agent/.nix-profile/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
shell_commands:
- apt update
- apt install --yes nix-setup-systemd
- nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
- nix-channel --update
- curl -L https://nixos.org/nix/install | sh -s -- --no-daemon
test_targets:
- "//..."
2 changes: 1 addition & 1 deletion .bcr/core/source.template.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"integrity": "",
"strip_prefix": "{REPO}-{VERSION}/core",
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/${REPO}-${VERSION}.tar.gz"
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{VERSION}.tar.gz"
}
128 changes: 121 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
flake = false;
};
flake-utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
Expand Down
1 change: 1 addition & 0 deletions testing/python/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ use_repo(non_module_deps, "nixpkgs")
use_repo(non_module_deps, "nixpkgs_python_toolchain")
use_repo(non_module_deps, "nixpkgs_python_configure_test")
use_repo(non_module_deps, "nixpkgs_python_toolchain_python3")
use_repo(non_module_deps, "poetry2nix")
register_toolchains("@nixpkgs_python_toolchain//:all")

use_repo(non_module_deps, "generated_poetry_packages_deps")
Expand Down
5 changes: 3 additions & 2 deletions testing/python/poetry.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
let
nixpkgs = import <nixpkgs> {};
inherit (nixpkgs) lib poetry2nix python3 runCommand;
nixpkgs = import <nixpkgs> { };
poetry2nix = import <poetry2nix> { pkgs = nixpkgs; };
inherit (nixpkgs) python3;

args = {
python = python3;
Expand Down
12 changes: 12 additions & 0 deletions testing/python/poetry2nix.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
poetry2nix =
let
src = lock.nodes.poetry2nix.locked;
in
assert src.type == "github";
fetchTarball {
url = "https://github.com/${src.owner}/${src.repo}/archive/${src.rev}.tar.gz";
sha256 = src.narHash;
};
in import poetry2nix
11 changes: 10 additions & 1 deletion testing/python/tests/nixpkgs_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ def nixpkgs_repositories(*, bzlmod):
nix_file_deps = ["//:flake.lock"],
)

nixpkgs_local_repository(
name = "poetry2nix",
nix_file = "//:poetry2nix.nix",
nix_file_deps = ["//:flake.lock"],
)

# Tests implicitly depend on Java
nixpkgs_java_configure(
name = "nixpkgs_java_runtime",
Expand Down Expand Up @@ -43,7 +49,10 @@ def nixpkgs_repositories(*, bzlmod):

nixpkgs_python_repository(
name = "poetry_packages",
repository = "@nixpkgs",
repositories = {
"nixpkgs": "@nixpkgs",
"poetry2nix": "@poetry2nix",
},
nix_file = "//:poetry.nix",
nix_file_deps = [
"//:pyproject.toml",
Expand Down

0 comments on commit 6915e95

Please sign in to comment.