![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
#include <derivation-env-desugar.hh>
Classes | |
| struct | EnvEntry |
Public Member Functions | |
| std::string & | atFileEnvPair (std::string_view name, std::string fileName) |
Static Public Member Functions | |
| static DesugaredEnv | create (Store &store, const BasicDerivation &drv, const derivation::Options< StorePath > &drvOptions, const StorePathSet &inputPaths) |
Public Attributes | |
| std::map< std::string, EnvEntry, std::less<> > | variables |
| StringMap | extraFiles |
Derivations claim to "just" specify their environment variables, but actually do a number of different features, such as "structured attrs", "pass as file", and "export references graph", things are more complicated then they appear.
The good news is that we can simplify all that to the following view, where environment variables and extra files are specified exactly, with no special cases.
Because we have DesugaredEnv, DerivationBuilder doesn't need to know about any of those above features, and their special case.
| std::string & nix::DesugaredEnv::atFileEnvPair | ( | std::string_view | name, |
| std::string | fileName ) |
A common case is to define an environment variable that points to a file, which contains some contents.
In base:
This function assists in doing both parts, so the file name is kept in sync.
|
static |
Given a (resolved) derivation, its options, and the closure of its inputs (which we can get since the derivation is resolved), desugar the environment to create a DesguaredEnv.
| StringMap nix::DesugaredEnv::extraFiles |
Extra file to be placed in the build directory.
| std::map<std::string, EnvEntry, std::less<> > nix::DesugaredEnv::variables |
The final environment variables to set.