How do I check if I’m running on NixOS (vs a different Linux distribution) in a bash script?
You can test whether the file
/etc/NIXOS exists. From the manual:
/etc/NIXOSofficializes that this is now a NixOS partition (the bootup scripts require its presence).
You could read
ID might be of interest.
grep ‘NAME=NixOS’ /etc/os-release