query
On this page

getEnv

builtins.getEnv

Primop
Docs pulled from | This Revision | 1 day ago

Takes 1 arguments

s


getEnv returns the value of the environment variable s, or an empty string if the variable doesn’t exist. This function should be used with care, as it can introduce all sorts of nasty environment dependencies in your Nix expression.

getEnv is used in Nix Packages to locate the file ~/.nixpkgs/config.nix, which contains user-local settings for Nix Packages. (That is, it does a getEnv "HOME" to locate the user’s home directory.)

This function is not defined in a .nix file. It is likely a builtins function or an alias of a builtins function. builtins functions are predefined functions provided by Nix.

Noogle detected

Detected Type
getEnv :: String -> String

Implementation

This function is implemented in c++ and is part of the native nix runtime.