1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-18 00:12:43 +01:00

Restore exposing machine file parsing

This was accidentally removed in
e989c83b44. I restored it and also did a
few other cleanups:

- Make a static method for namespacing purposes

- Put the test files in the data dir with the other test data

- Avoid mutating globals in the machine config tests

This will be used by Hydra.
This commit is contained in:
John Ericson 2024-05-22 23:12:23 -04:00
parent 5845fd59c3
commit f2bcebc450
6 changed files with 72 additions and 61 deletions

View file

@ -8,6 +8,10 @@ namespace nix {
class Store;
struct Machine;
typedef std::vector<Machine> Machines;
struct Machine {
const StoreReference storeUri;
@ -63,12 +67,22 @@ struct Machine {
* ```
*/
ref<Store> openStore() const;
/**
* Parse a machine configuration.
*
* Every machine is specified on its own line, and lines beginning
* with `@` are interpreted as paths to other configuration files in
* the same format.
*/
static Machines parseConfig(const std::set<std::string> & defaultSystems, const std::string & config);
};
typedef std::vector<Machine> Machines;
void parseMachines(const std::string & s, Machines & machines);
/**
* Parse machines from the global config
*
* @todo Remove, globals are bad.
*/
Machines getMachines();
}