Skip to content

Commit 7409347

Browse files
authored
Install rust nightly (apaolillo#26)
In the `install_rust()` method, add a parameter that let us choose if the Rust version to install is a nightly one or not. Example : ```python install_rust( builder=builder, nightly=True, ) ``` Signed-off-by: Attilio <[email protected]>
1 parent 5e1ace9 commit 7409347

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/pythainer/examples/builders/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ def rust_builder(
267267
install_clippy: bool = True,
268268
install_cargo_edit: bool = True,
269269
install_cargo_watch: bool = False,
270+
install_nightly: bool = False,
270271
) -> PartialDockerBuilder:
271272
"""
272273
Sets up a Docker builder for Rust development by installing Rust via rustup
@@ -277,6 +278,7 @@ def rust_builder(
277278
install_clippy (bool): Whether to install the clippy linter.
278279
install_cargo_edit (bool): Whether to install cargo-edit (adds `cargo add`, etc.).
279280
install_cargo_watch (bool): Whether to install cargo-watch for file change detection.
281+
install_nightly (bool): Whether to install the nightly version of rust or not.
280282
281283
Returns:
282284
PartialDockerBuilder: Docker builder configured for Rust development.
@@ -285,7 +287,10 @@ def rust_builder(
285287
builder.user()
286288

287289
# Install Rust using rustup (non-interactive)
288-
builder.run("curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y")
290+
cmd = "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y"
291+
if install_nightly:
292+
cmd += " --default-toolchain nightly"
293+
builder.run(cmd)
289294

290295
# Set environment variable to include Rust's cargo bin directory in PATH
291296
builder.env(name="PATH", value="/home/${USER_NAME}/.cargo/bin:$PATH")

src/pythainer/examples/runners/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def personal_runner(
146146

147147
dotfiles = (
148148
[
149-
Path("~/dotfiles").expanduser(),
149+
Path("~/dotfiles/").expanduser(),
150150
Path("~/.bashrc").expanduser(),
151151
Path("~/.zshrc").expanduser(),
152152
]

0 commit comments

Comments
 (0)