Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
environment-variables.hh
Go to the documentation of this file.
1#pragma once
8
9#include <optional>
10
11#include "nix/util/types.hh"
12#include "nix/util/os-string.hh"
13
14namespace nix {
15
19std::optional<std::string> getEnv(const std::string & key);
20
24std::optional<OsString> getEnvOs(const OsString & key);
25
30
35std::optional<std::string> getEnvNonEmpty(const std::string & key);
36
41std::optional<OsString> getEnvOsNonEmpty(const OsString & key);
42
46StringMap getEnv();
47
56void setEnv(const char * name, const char * value);
57
61void setEnvOs(const OsString & name, const OsString & value);
62
70void unsetEnv(const char * name);
71
75void unsetEnvOs(const OsChar * name);
76
80void clearEnv();
81
85void replaceEnv(const StringMap & newEnv);
86
87} // namespace nix
void setEnvOs(const OsString &name, const OsString &value)
Definition environment-variables.cc:33
void unsetEnv(const char *name)
Definition environment-variables.cc:60
std::optional< OsString > getEnvOs(const OsString &key)
Definition environment-variables.cc:13
void setEnv(const char *name, const char *value)
Definition environment-variables.cc:55
void unsetEnvOs(const OsChar *name)
Definition environment-variables.cc:39
char OsChar
Definition os-string.hh:21
std::basic_string< OsChar > OsString
Definition os-string.hh:36
std::map< OsString, OsString, std::less<> > OsStringMap
Definition os-string.hh:46
std::map< std::string, std::string, std::less<> > StringMap
Definition types.hh:26