diff --git a/nix/microvm/user-config.nix b/nix/microvm/user-config.nix index c7ba38e5..1168af25 100644 --- a/nix/microvm/user-config.nix +++ b/nix/microvm/user-config.nix @@ -115,7 +115,8 @@ in { # put the devshell into the resulting image env. # we do this instead of using a `.nix` file because it lets us skip eval time. environment.etc = lib.mkIf (dependencies != []) { - "spindle/devshell.drv".source = spindleDevShell.drvPath; + # this is safe because we have the closure in the env also! + "spindle/devshell-drv".text = builtins.unsafeDiscardStringContext spindleDevShell.drvPath; "spindle/devshell-closure".source = pkgs.closureInfo {rootPaths = [spindleDevShell];}; }; services = builtins.mapAttrs (normalize (options.services or {})) (userConfig.services or {}); diff --git a/shuttle/src/activation.rs b/shuttle/src/activation.rs index 79af5b23..d5ae31b2 100644 --- a/shuttle/src/activation.rs +++ b/shuttle/src/activation.rs @@ -10,7 +10,7 @@ use tracing::info; const USER_CONFIG_DIR: &str = "/run/spindle/user-config"; const DEVSHELL_ENV_PATH: &str = "/run/spindle/devshell-env.sh"; -const DEVSHELL_DRV: &str = "/etc/spindle/devshell.drv"; +const DEVSHELL_DRV: &str = "/etc/spindle/devshell-drv"; pub async fn run(id: String, req: v1::ActivateConfig, out: Sender) { let config_key = req.config_key.clone(); @@ -58,13 +58,15 @@ async fn activate(id: &str, req: &v1::ActivateConfig, out: &Sender) -> } async fn write_devshell_env(timeout: Duration) -> Result<()> { - let drv = match fs::canonicalize(DEVSHELL_DRV) { - Ok(p) => p, - Err(_) => { - let _ = fs::remove_file(DEVSHELL_ENV_PATH); - return Ok(()); - } - }; + let pointer = Path::new(DEVSHELL_DRV); + if !pointer.exists() { + let _ = fs::remove_file(DEVSHELL_ENV_PATH); + return Ok(()); + } + let drv = fs::read_to_string(&pointer) + .with_context(|| format!("read {pointer:?}"))? + .trim() + .to_owned(); info!( ?drv, @@ -72,11 +74,7 @@ async fn write_devshell_env(timeout: Duration) -> Result<()> { ); let output = run_capture( Spec::new(nix_executable()) - .args([ - "print-dev-env".into(), - "--show-trace".into(), - drv.into_os_string(), - ]) + .args(["print-dev-env", "--show-trace", &drv]) .cwd(SPINDLE_RUN_DIR) .timeout(timeout), ) diff --git a/spindle/engines/microvm/test-spindle-microvm.sh b/spindle/engines/microvm/test-spindle-microvm.sh index 9eac70cf..142cf55c 100755 --- a/spindle/engines/microvm/test-spindle-microvm.sh +++ b/spindle/engines/microvm/test-spindle-microvm.sh @@ -338,7 +338,7 @@ run_vm() { --work-dir "$work_dir" --exec-timeout "$timeout" --port "${SPINDLE_TEST_VSOCK_PORT:-10240}" - --memory-mib 2049 + --memory-mib 4096 ) if [ "$no_cache" -eq 0 ]; then