From 1f78b0e6e5a67a1a00c6a3b1143713d7e28cd71d Mon Sep 17 00:00:00 2001 From: James Leitch Date: Sun, 10 Dec 2023 13:32:37 -0700 Subject: [PATCH] Nix example switched to using `crate_universe_dependencies(bootstrap = True)`. --- crate_universe/flake.lock | 61 ------------------- crate_universe/flake.nix | 26 -------- examples/nix_cross_compiling/WORKSPACE.bazel | 10 ++- .../bazel/nix_repositories.bzl | 14 ----- 4 files changed, 9 insertions(+), 102 deletions(-) delete mode 100644 crate_universe/flake.lock delete mode 100644 crate_universe/flake.nix diff --git a/crate_universe/flake.lock b/crate_universe/flake.lock deleted file mode 100644 index f3c5cbdd90..0000000000 --- a/crate_universe/flake.lock +++ /dev/null @@ -1,61 +0,0 @@ -{ - "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1700444282, - "narHash": "sha256-s/+tgT+Iz0LZO+nBvSms+xsMqvHt2LqYniG9r+CYyJc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "3f21a22b5aafefa1845dec6f4a378a8f53d8681c", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/crate_universe/flake.nix b/crate_universe/flake.nix deleted file mode 100644 index 55672167f3..0000000000 --- a/crate_universe/flake.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - - flake-utils.url = "github:numtide/flake-utils"; - }; - - outputs = { self, nixpkgs, flake-utils, ... }: - flake-utils.lib.eachDefaultSystem (system: - let - pkgs = import nixpkgs { inherit system; }; - in - { - packages.cargo-bazel = pkgs.rustPlatform.buildRustPackage { - pname = "cargo-bazel"; - version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version; - - src = ./.; - cargoLock.lockFile = ./Cargo.lock; - - # Tests cannot be run via Cargo due to the dependency on the - # Bazel `runfiles` crate. - doCheck = false; - }; - }); -} diff --git a/examples/nix_cross_compiling/WORKSPACE.bazel b/examples/nix_cross_compiling/WORKSPACE.bazel index d4605e7c2a..aeedfdfca4 100644 --- a/examples/nix_cross_compiling/WORKSPACE.bazel +++ b/examples/nix_cross_compiling/WORKSPACE.bazel @@ -26,6 +26,14 @@ load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies") rules_rust_dependencies() +load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") + +crate_universe_dependencies( + bootstrap = True, + rust_toolchain_cargo_template = "@nix_rust//:bin/{tool}", + rust_toolchain_rustc_template = "@nix_rust//:bin/{tool}", +) + load("@rules_rust//crate_universe:defs.bzl", "crates_repository", "render_config", "splicing_config") load("//bazel/cargo:crates_repository.bzl", CARGO_ANNOTATIONS = "ANNOTATIONS", CARGO_PACKAGES = "PACKAGES") @@ -34,7 +42,7 @@ crates_repository( annotations = CARGO_ANNOTATIONS, cargo_lockfile = "//bazel/cargo:Cargo.lock", generate_build_scripts = False, - generator = "@cargo-bazel//:bin/cargo-bazel", + generator = "@cargo_bazel_bootstrap//:cargo-bazel", lockfile = "//bazel/cargo:cargo-bazel-lock.json", packages = CARGO_PACKAGES, render_config = render_config( diff --git a/examples/nix_cross_compiling/bazel/nix_repositories.bzl b/examples/nix_cross_compiling/bazel/nix_repositories.bzl index bb5e2f98af..378eed7d6c 100644 --- a/examples/nix_cross_compiling/bazel/nix_repositories.bzl +++ b/examples/nix_cross_compiling/bazel/nix_repositories.bzl @@ -201,12 +201,6 @@ rust_stdlib_filegroup( ) """ -_CARGO_BAZEL_BUILD_FILE_CONTENT = """ -package(default_visibility = ["//visibility:public"]) - -exports_files(["bin/cargo-bazel"]) -""" - def nix_repositories(): nixpkgs_flake_package( name = "nix_config", @@ -223,11 +217,3 @@ def nix_repositories(): package = "bazel.rust", build_file_content = _RUST_BUILD_FILE_CONTENT, ) - - nixpkgs_flake_package( - name = "cargo-bazel", - nix_flake_file = "@rules_rust//crate_universe:flake.nix", - nix_flake_lock_file = "@rules_rust//crate_universe:flake.lock", - package = "cargo-bazel", - build_file_content = _CARGO_BAZEL_BUILD_FILE_CONTENT, - )