Skip to content

Commit 919a8a5

Browse files
committed
Fix NixOS detection
Use `/etc/os-release` instead of `/etc/NIXOS`. The latter one does not exist on NixOS when using tmpfs as root.
1 parent a6470c7 commit 919a8a5

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)