diff --git a/src/planner/linux.rs b/src/planner/linux.rs index 9eab5b3..7b947e5 100644 --- a/src/planner/linux.rs +++ b/src/planner/linux.rs @@ -39,6 +39,10 @@ impl Planner for Linux { return Err(PlannerError::NixOs); } + if std::env::var("WSL_DISTRO_NAME").is_ok() && std::env::var("WSL_INTEROP").is_err() { + return Err(PlannerError::Wsl1); + } + // We currently do not support SELinux match Command::new("getenforce").output().await { Ok(output) => { diff --git a/src/planner/mod.rs b/src/planner/mod.rs index cbb1563..c46d797 100644 --- a/src/planner/mod.rs +++ b/src/planner/mod.rs @@ -301,6 +301,8 @@ pub enum PlannerError { NixOs, #[error("`nix` is already a valid command, so it is installed")] NixExists, + #[error("WSL1 is not supported, please upgrade to WSL2: https://learn.microsoft.com/en-us/windows/wsl/install#upgrade-version-from-wsl-1-to-wsl-2")] + Wsl1, } impl HasExpectedErrors for PlannerError { @@ -315,6 +317,7 @@ impl HasExpectedErrors for PlannerError { PlannerError::Custom(_) => None, this @ PlannerError::NixOs => Some(Box::new(this)), this @ PlannerError::NixExists => Some(Box::new(this)), + this @ PlannerError::Wsl1 => Some(Box::new(this)), } } }