diff options
Diffstat (limited to 'src/libstore/globals.cc')
-rw-r--r-- | src/libstore/globals.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc index cec85edca..5f1ae5ab5 100644 --- a/src/libstore/globals.cc +++ b/src/libstore/globals.cc @@ -117,6 +117,15 @@ void Settings::requireExperimentalFeature(const std::string & name) throw Error("experimental Nix feature '%s' is disabled", name); } +bool Settings::isWSL1() +{ + struct utsname utsbuf; + uname(&utsbuf); + // WSL1 uses -Microsoft suffix + // WSL2 uses -microsoft-standard suffix + return hasSuffix(utsbuf.release, "-Microsoft"); +} + const string nixVersion = PACKAGE_VERSION; template<> void BaseSetting<SandboxMode>::set(const std::string & str) |