Skip to content

Commit 2db19e0

Browse files
domenkozarsandydoo
authored andcommitted
Merge pull request #2083 from cachix/fix-container
devenv: fix building containers
2 parents 8deba1d + 642fac4 commit 2db19e0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

devenv/src/devenv.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,13 +463,16 @@ impl Devenv {
463463
skip(self),
464464
fields(devenv.user_message = format!("Building {name} container"))
465465
)]
466-
pub async fn container_build(&self, name: &str) -> Result<String> {
466+
pub async fn container_build(&mut self, name: &str) -> Result<String> {
467467
if cfg!(target_os = "macos") {
468468
bail!(
469469
"Containers are not supported on macOS yet: https://github.com/cachix/devenv/issues/430"
470470
);
471471
}
472472

473+
// This container name is passed to the flake as an argument and tells the module system
474+
// that we're 1. building a container 2. which container we're building.
475+
self.container_name = Some(name.to_string());
473476
self.assemble(false).await?;
474477

475478
let sanitized_name = sanitize_container_name(name);
@@ -489,7 +492,7 @@ impl Devenv {
489492
}
490493

491494
pub async fn container_copy(
492-
&self,
495+
&mut self,
493496
name: &str,
494497
copy_args: &[String],
495498
registry: Option<&str>,
@@ -540,7 +543,7 @@ impl Devenv {
540543
}
541544

542545
pub async fn container_run(
543-
&self,
546+
&mut self,
544547
name: &str,
545548
copy_args: &[String],
546549
registry: Option<&str>,

devenv/src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ async fn main() -> Result<()> {
108108
name,
109109
command,
110110
} => {
111-
devenv.container_name = name.clone();
112-
113111
// Backwards compatibility for the legacy container flags:
114112
// `devenv container <name> --copy` is now `devenv container copy <name>`
115113
// `devenv container <name> --docker-run` is now `devenv container run <name>`

0 commit comments

Comments
 (0)