diff --git a/flake.lock b/flake.lock index d1ab815af..376c612ee 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -34,13 +34,52 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1698974481, + "narHash": "sha256-yPncV9Ohdz1zPZxYHQf47S8S0VrnhV7nNhCawY46hDA=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "4bb5e752616262457bc7ca5882192a564c0472d2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1695644571, - "narHash": "sha256-asS9dCCdlt1lPq0DLwkVBbVoEKuEuz+Zi3DG7pR/RxA=", + "lastModified": 1699099776, + "narHash": "sha256-X09iKJ27mGsGambGfkKzqvw5esP1L/Rf8H3u3fCqIiU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6500b4580c2a1f3d0f980d32d285739d8e156d92", + "rev": "85f1ba3e51676fa8cc604a3d863d729026a6b8eb", "type": "github" }, "original": { @@ -50,11 +89,36 @@ "type": "github" } }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils_2", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_3", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1699321798, + "narHash": "sha256-LUoC+M1SaeZyhrT673FPVivq6Wn1Us6rjaG6EkUmUuw=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "bf0601d5d9ae7334fa80f5f7c9648009390046ca", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, "root": { "inputs": { "flake-compat": "flake-compat", "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "poetry2nix": "poetry2nix" } }, "systems": { @@ -71,6 +135,56 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1698438538, + "narHash": "sha256-AWxaKTDL3MtxaVTVU5lYBvSnlspOS0Fjt8GxBgnU0Do=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "5deb8dc125a9f83b65ca86cf0c8167c46593e0b1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index f6fd9eb49..e37384c02 100644 --- a/flake.nix +++ b/flake.nix @@ -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: diff --git a/testing/python/MODULE.bazel b/testing/python/MODULE.bazel index 6296bcba8..8bfbcd180 100644 --- a/testing/python/MODULE.bazel +++ b/testing/python/MODULE.bazel @@ -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") diff --git a/testing/python/poetry.nix b/testing/python/poetry.nix index 640a278a3..2fdd83eec 100644 --- a/testing/python/poetry.nix +++ b/testing/python/poetry.nix @@ -1,6 +1,7 @@ let - nixpkgs = import {}; - inherit (nixpkgs) lib poetry2nix python3 runCommand; + nixpkgs = import { }; + poetry2nix = import { pkgs = nixpkgs; }; + inherit (nixpkgs) python3; args = { python = python3; diff --git a/testing/python/poetry2nix.nix b/testing/python/poetry2nix.nix new file mode 100644 index 000000000..797d5ed56 --- /dev/null +++ b/testing/python/poetry2nix.nix @@ -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 diff --git a/testing/python/tests/nixpkgs_repositories.bzl b/testing/python/tests/nixpkgs_repositories.bzl index f1d8921e8..451b07463 100644 --- a/testing/python/tests/nixpkgs_repositories.bzl +++ b/testing/python/tests/nixpkgs_repositories.bzl @@ -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", @@ -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",