Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
environment-variables.hh File Reference
#include <map>
#include <optional>
#include <string>

Go to the source code of this file.

Functions

std::optional< std::string > nix::getEnv (const std::string &key)
std::optional< std::string > nix::getEnvNonEmpty (const std::string &key)
std::map< std::string, std::string > nix::getEnv ()
void nix::clearEnv ()
void nix::replaceEnv (const std::map< std::string, std::string > &newEnv)

Detailed Description

Utilities for working with the current process's environment variables.

Function Documentation

◆ clearEnv()

void nix::clearEnv ( )

Clear the environment.

◆ getEnv() [1/2]

std::map< std::string, std::string > nix::getEnv ( )

Get the entire environment.

◆ getEnv() [2/2]

std::optional< std::string > nix::getEnv ( const std::string & key)
Returns
an environment variable.

◆ getEnvNonEmpty()

std::optional< std::string > nix::getEnvNonEmpty ( const std::string & key)
Returns
a non empty environment variable. Returns nullopt if the env variable is set to ""

◆ replaceEnv()

void nix::replaceEnv ( const std::map< std::string, std::string > & newEnv)

Replace the entire environment with the given one.