From 7e2f86c1c0463ba8ff8765299561287e4661efe3 Mon Sep 17 00:00:00 2001
From: Tamir Duberstein <tamird@gmail.com>
Date: Tue, 26 Nov 2024 16:10:46 -0500
Subject: [PATCH] Remove rust-toolchain

Doesn't make much sense in a workspace.
---
 {{project-name}}-ebpf/rust-toolchain.toml | 3 ---
 {{project-name}}/build.rs                 | 5 +++--
 2 files changed, 3 insertions(+), 5 deletions(-)
 delete mode 100644 {{project-name}}-ebpf/rust-toolchain.toml

diff --git a/{{project-name}}-ebpf/rust-toolchain.toml b/{{project-name}}-ebpf/rust-toolchain.toml
deleted file mode 100644
index f70d225..0000000
--- a/{{project-name}}-ebpf/rust-toolchain.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-[toolchain]
-channel = "nightly"
-components = ["rust-src"]
diff --git a/{{project-name}}/build.rs b/{{project-name}}/build.rs
index fa41cc9..e9c7fd5 100644
--- a/{{project-name}}/build.rs
+++ b/{{project-name}}/build.rs
@@ -59,6 +59,7 @@ fn main() {
 
         let mut cmd = Command::new("cargo");
         cmd.args([
+            "+nightly",
             "build",
             "-Z",
             "build-std=core",
@@ -71,8 +72,8 @@ fn main() {
 
         cmd.env("CARGO_CFG_BPF_TARGET_ARCH", arch);
 
-        // Workaround to make sure that the rust-toolchain.toml is respected.
-        for key in ["RUSTUP_TOOLCHAIN", "RUSTC", "RUSTC_WORKSPACE_WRAPPER"] {
+        // Workaround to make sure that the correct toolchain is used.
+        for key in ["RUSTC", "RUSTC_WORKSPACE_WRAPPER"] {
             cmd.env_remove(key);
         }
         cmd.current_dir(ebpf_dir);