Skip to content

Commit 0cd1422

Browse files
committed
cli: skip glibc check for nixos
Fixes microsoft/vscode-remote-release#7129
1 parent f8995e0 commit 0cd1422

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

cli/src/util/prereqs.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ lazy_static! {
2323
static ref MIN_LDD_VERSION: SimpleSemver = SimpleSemver::new(2, 17, 0);
2424
}
2525

26+
const NIXOS_TEST_PATH: &str = "/etc/NIXOS";
27+
2628
pub struct PreReqChecker {}
2729

2830
impl Default for PreReqChecker {
@@ -45,13 +47,14 @@ impl PreReqChecker {
4547

4648
#[cfg(target_os = "linux")]
4749
pub async fn verify(&self) -> Result<Platform, AnyError> {
48-
let (gnu_a, gnu_b, or_musl) = tokio::join!(
50+
let (is_nixos, gnu_a, gnu_b, or_musl) = tokio::join!(
51+
check_is_nixos(),
4952
check_glibc_version(),
5053
check_glibcxx_version(),
5154
check_musl_interpreter()
5255
);
5356

54-
if gnu_a.is_ok() && gnu_b.is_ok() {
57+
if (gnu_a.is_ok() && gnu_b.is_ok()) || is_nixos {
5558
return Ok(if cfg!(target_arch = "x86_64") {
5659
Platform::LinuxX64
5760
} else if cfg!(target_arch = "armhf") {
@@ -132,6 +135,13 @@ async fn check_glibc_version() -> Result<(), String> {
132135
Ok(())
133136
}
134137

138+
/// Check for nixos to avoid mandating glibc versions. See:
139+
/// https://github.com/microsoft/vscode-remote-release/issues/7129
140+
#[allow(dead_code)]
141+
async fn check_is_nixos() -> bool {
142+
fs::metadata(NIXOS_TEST_PATH).await.is_ok()
143+
}
144+
135145
#[allow(dead_code)]
136146
async fn check_glibcxx_version() -> Result<(), String> {
137147
let mut libstdc_path: Option<String> = None;

0 commit comments

Comments
 (0)