From 8a1f493a8454ccc93e371ca62073d72fc7ae56b6 Mon Sep 17 00:00:00 2001
From: Yethal <26117918+Yethal@users.noreply.github.com>
Date: Fri, 7 Mar 2025 09:36:27 +0100
Subject: [PATCH 1/2] Correct Nushell source command

---
 rustup-init.sh               | 2 +-
 src/cli/self_update.rs       | 6 +++---
 src/cli/self_update/shell.rs | 3 ++-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/rustup-init.sh b/rustup-init.sh
index a48afd171b..52f2b9e1f5 100755
--- a/rustup-init.sh
+++ b/rustup-init.sh
@@ -33,7 +33,7 @@ RUSTUP_QUIET=no
 # NOTICE: If you change anything here, please make the same changes in setup_mode.rs
 usage() {
     cat <<EOF
-rustup-init 1.28.1 (83ac5d9ec 2025-03-04)
+rustup-init 1.28.1 (bb9441b61 2025-03-05)
 
 The installer for rustup
 
diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs
index 89ee515ac3..5c0666ef04 100644
--- a/src/cli/self_update.rs
+++ b/src/cli/self_update.rs
@@ -382,9 +382,9 @@ macro_rules! post_install_msg_unix_source_env {
 the corresponding `env` file under {cargo_home}.
 
 This is usually done by running one of the following (note the leading DOT):
-    . "{cargo_home}/env"            # For sh/bash/zsh/ash/dash/pdksh
-    source "{cargo_home}/env.fish"  # For fish
-    source "{cargo_home}/env.nu"    # For nushell
+    . "{cargo_home}/env"                       # For sh/bash/zsh/ash/dash/pdksh
+    source "{cargo_home}/env.fish"             # For fish
+    source $"($nu.home-path)/.cargo/env.nu"    # For nushell
 "#
     };
 }
diff --git a/src/cli/self_update/shell.rs b/src/cli/self_update/shell.rs
index bcde8c23ef..025356e719 100644
--- a/src/cli/self_update/shell.rs
+++ b/src/cli/self_update/shell.rs
@@ -299,7 +299,8 @@ impl UnixShell for Nu {
     }
 
     fn source_string(&self, process: &Process) -> Result<String> {
-        Ok(format!(r#"source "{}/env.nu""#, cargo_home_str(process)?))
+        let cargo_home_nushell = (cargo_home_str(process)?).replace("$HOME", "($nu.home-path)");
+        Ok(format!(r#"source $"{}/env.nu""#, cargo_home_nushell))
     }
 }
 

From a4e468e2ceb993590dda12287ef32ac25478b095 Mon Sep 17 00:00:00 2001
From: Yethal <26117918+Yethal@users.noreply.github.com>
Date: Fri, 7 Mar 2025 10:06:23 +0100
Subject: [PATCH 2/2] Correct Nushell source command

---
 rustup-init.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rustup-init.sh b/rustup-init.sh
index 52f2b9e1f5..a48afd171b 100755
--- a/rustup-init.sh
+++ b/rustup-init.sh
@@ -33,7 +33,7 @@ RUSTUP_QUIET=no
 # NOTICE: If you change anything here, please make the same changes in setup_mode.rs
 usage() {
     cat <<EOF
-rustup-init 1.28.1 (bb9441b61 2025-03-05)
+rustup-init 1.28.1 (83ac5d9ec 2025-03-04)
 
 The installer for rustup