Skip to content

Commit

Permalink
Fix NixOS detection
Browse files Browse the repository at this point in the history
Use `/etc/os-release` instead of `/etc/NIXOS`.
The latter one does not exist on NixOS when using tmpfs as root.
  • Loading branch information
oxalica committed Jul 20, 2021
1 parent a6470c7 commit 919a8a5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,13 @@ def fix_bin_or_dylib(self, fname):
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
Expand Down

0 comments on commit 919a8a5

Please sign in to comment.