Skip to content
Configuration variables

Configuration variables

Every environment variable nem reads, and every one it sets.

Variables nem reads

VariableDefaultEffect
NEM_HOME~/.nemWhere everything nem installs and records lives, used as given: no ~ expansion, a relative value resolves against each command's working directory, and an empty value counts as unset. See NEM_HOME.
NO_COLORunsetAny non-empty value disables colour when --color is auto.
FORCE_COLORunsetAny non-empty value forces colour when --color is auto and NO_COLOR is not set.
NEM_NARRATIONunsetauto, plain or json; the --narration flag wins when set to a value other than auto. See Narration.
GITHUB_TOKENunsetRaises the GitHub API rate limit for nem self update and for the release checksum lookups in nem catalog bump.
DOCKER_CONFIG~/.dockerDirectory holding the config.json that registry credentials are read from.
SHELLbash when unsetPicks the dialect for nem activate, nem deactivate, and nem env when no shell is named.
HTTP_PROXY, HTTPS_PROXY, NO_PROXYunsetStandard proxy settings, in upper or lower case with upper case winning, honoured for every download and registry request. ALL_PROXY is not read.

Beyond these, nem is configured only through its files: config.yaml for catalogs and hosts, and a project's nem.toml. TMPDIR is never read; all staging goes under $NEM_HOME/tmp.

Install script variables

The install script at https://raw.githubusercontent.com/vi-dev/nem/main/install.sh reads:

VariableDefaultEffect
NEM_VERSIONlatest releaseA release tag such as v0.1.0, or unstable for the rolling build from main.
NEM_INSTALL_DIR~/.local/binWhere the binary is placed.
GITHUB_TOKENunsetRaises the GitHub API rate limit while the script looks up releases.

Variables the shell hook sets

The block that nem activate installs, and the script nem env prints, keep their bookkeeping in your shell's environment:

VariableSet byMeaning
PATHnem envPackage directories ahead of the original PATH.
NEM_ORIGINAL_PATHthe hook block and nem env, oncePATH before nem first changed it.
NEM_MANAGED_KEYSnem envSpace-separated names of the variables nem currently manages.
NEM_SAVED__<NAME>nem envThe value <NAME> had before nem set it.
NEM_SAVED__<NAME>_SETnem envWhether <NAME> existed before nem set it, so leaving a project can unset it again.
DYLD_LIBRARY_PATH on macOS, LD_LIBRARY_PATH on Linuxnem envComposed only when a library package is in the environment.

Because of this bookkeeping, the prefixes NEM_, LD_, DYLD_ and the suffix _SET are on the reserved list, together with names such as PATH and PS1, matched case-insensitively. A [env] entry using one is dropped with a warning; a package export using one fails nem catalog lint, and one that reached a catalog anyway is dropped with the same warning when the environment is composed.

nem exec sets the same PATH, loader variable, and [env] values in its child process, with two differences: it keeps none of the NEM_SAVED__*, NEM_MANAGED_KEYS, or NEM_ORIGINAL_PATH bookkeeping, and it prepends to the PATH it inherited rather than rebuilding from NEM_ORIGINAL_PATH.

Variables in build and test steps

nem catalog build and nem catalog test run a package's build.steps and test scripts under sh -c. The steps inherit nem's own environment, and nem sets these on top of it:

VariableBuildTestMeaning
NEM_VERSIONyesyesThe version being built or tested.
NEM_OS, NEM_ARCHyesyesThe platform, such as darwin and arm64.
NEM_PREFIXyesyesIn a build, the directory the package will install into. In a test, the throwaway install under packages/<name>-NEMTEST-*/, deleted when the test finishes; never record it.
NEM_STAGING_DIRyesnoThe staging root; the steps run in the unpacked source below it.
NEM_OUTPUTyesnoThe absolute path of build.output; steps fill it.
PWDyesyesThe directory the step runs in: the unpacked source in a build, a scratch directory in a test.
NEM_DEP_<NAME>_PREFIXyesyesThe install directory of each resolved dependency, transitive ones included, with the name upper-cased and other characters replaced by _. A build resolves build.deps; a test resolves the run-time deps, plus one entry for the package itself under its throwaway name.
PATHyesyesThe bins of dependencies on the path or loader path, prepended; in a test the package's own bins come first.
CPPFLAGS, CFLAGS, CGO_CFLAGSyesyes-I flags for each link dependency's include directory, appended after any inherited value.
LDFLAGS, CGO_LDFLAGSyesyes-L and rpath flags for each link dependency, appended; in a build on Linux also $ORIGIN rpaths so a package's binaries and libraries find the libraries in its own libs directories; on macOS always -Wl,-headerpad_max_install_names as well.
PKG_CONFIG_PATHyesyesEach link dependency's pkgconfig directories, joined with the path-list separator and appended.
DYLD_LIBRARY_PATH on macOS, LD_LIBRARY_PATH on LinuxnoyesThe libs of the package and its link dependencies; any inherited value is dropped first.

Related