mirror of
https://github.com/NixOS/nix
synced 2025-07-05 08:11:47 +02:00
Allow nix.conf options to be set in flake.nix
This makes it possible to have per-project configuration in flake.nix, e.g. binary caches and other stuff: nixConfig.bash-prompt-suffix = "[1;35mngi# [0m"; nixConfig.substituters = [ "https://cache.ngi0.nixos.org/" ];
This commit is contained in:
parent
731edf0d9b
commit
343239fc8a
3 changed files with 80 additions and 6 deletions
|
@ -47,8 +47,16 @@ struct FlakeInput
|
|||
FlakeInputs overrides;
|
||||
};
|
||||
|
||||
// The Flake structure is the main internal representation of a flake.nix file.
|
||||
struct ConfigFile
|
||||
{
|
||||
using ConfigValue = std::variant<std::string, int64_t, Explicit<bool>, std::vector<std::string>>;
|
||||
|
||||
std::map<std::string, ConfigValue> options;
|
||||
|
||||
void apply();
|
||||
};
|
||||
|
||||
/* The contents of a flake.nix file. */
|
||||
struct Flake
|
||||
{
|
||||
FlakeRef originalRef; // the original flake specification (by the user)
|
||||
|
@ -57,6 +65,7 @@ struct Flake
|
|||
std::optional<std::string> description;
|
||||
std::shared_ptr<const fetchers::Tree> sourceInfo;
|
||||
FlakeInputs inputs;
|
||||
ConfigFile config; // 'nixConfig' attribute
|
||||
~Flake();
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue