Rollup merge of #87187 - oxalica:fix-nixos-detect, r=nagisa
Fix NixOS detection Use `/etc/os-release` instead of `/etc/NIXOS` for detection. The latter one does not exist on NixOS when using tmpfs as root.
This commit is contained in:
commit
2861265f26
1 changed files with 7 additions and 1 deletions
|
@ -580,7 +580,13 @@ class RustBuild(object):
|
||||||
if ostype != "Linux":
|
if ostype != "Linux":
|
||||||
return
|
return
|
||||||
|
|
||||||
if not os.path.exists("/etc/NIXOS"):
|
# Use `/etc/os-release` instead of `/etc/NIXOS`.
|
||||||
|
# The latter one does not exist on NixOS when using tmpfs as root.
|
||||||
|
try:
|
||||||
|
with open("/etc/os-release", "r") as f:
|
||||||
|
if not any(line.strip() == "ID=nixos" for line in f):
|
||||||
|
return
|
||||||
|
except FileNotFoundError:
|
||||||
return
|
return
|
||||||
if os.path.exists("/lib"):
|
if os.path.exists("/lib"):
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue