mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-02 01:52:51 +00:00
Fix NixOS detection
Use `/etc/os-release` instead of `/etc/NIXOS`. The latter one does not exist on NixOS when using tmpfs as root.
This commit is contained in:
parent
a6470c7fa8
commit
919a8a5028
@ -580,7 +580,13 @@ class RustBuild(object):
|
||||
if ostype != "Linux":
|
||||
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
|
||||
if os.path.exists("/lib"):
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user