1
0
Fork 0
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 = "ngi# ";
  nixConfig.substituters = [ "https://cache.ngi0.nixos.org/" ];
This commit is contained in:
Eelco Dolstra 2020-10-26 20:45:39 +01:00
parent 731edf0d9b
commit 343239fc8a
3 changed files with 80 additions and 6 deletions

View file

@ -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();
};