File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ from strutils import contains, toLowerAscii
2929
3030when not defined (nimscript):
3131 from osproc import execProcess
32+ from os import existsEnv
3233
3334type
3435 Distribution * {.pure .} = enum # # the list of known distributions
105106 Clonezilla
106107 SteamOS
107108 Absolute
108- NixOS
109+ NixOS # # NixOS or a Nix build environment
109110 AUSTRUMI
110111 Arya
111112 Porteus
@@ -161,6 +162,9 @@ proc detectOsImpl(d: Distribution): bool =
161162 of Distribution .BSD : result = defined (bsd)
162163 of Distribution .ArchLinux :
163164 result = " arch" in toLowerAscii (uname ())
165+ of Distribution .NixOS :
166+ result = existsEnv (" NIX_BUILD_TOP" ) or existsEnv (" __NIXOS_SET_ENVIRONMENT_DONE" )
167+ # Check if this is a Nix build or NixOS environment
164168 of Distribution .OpenSUSE :
165169 result = " suse" in toLowerAscii (uname ()) or " suse" in toLowerAscii (release ())
166170 of Distribution .GoboLinux :
You can’t perform that action at this time.
0 commit comments