Skip to content

Commit 2861265

Browse files
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.
2 parents cf932aa + 919a8a5 commit 2861265

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/bootstrap/bootstrap.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,13 @@ def fix_bin_or_dylib(self, fname):
580580
if ostype != "Linux":
581581
return
582582

583-
if not os.path.exists("/etc/NIXOS"):
583+
# Use `/etc/os-release` instead of `/etc/NIXOS`.
584+
# The latter one does not exist on NixOS when using tmpfs as root.
585+
try:
586+
with open("/etc/os-release", "r") as f:
587+
if not any(line.strip() == "ID=nixos" for line in f):
588+
return
589+
except FileNotFoundError:
584590
return
585591
if os.path.exists("/lib"):
586592
return

0 commit comments

Comments
 (0)