1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-05 08:11:47 +02:00

Turn flake inputs into an attrset

Instead of a list, inputs are now an attrset like

  inputs = {
    nixpkgs.uri = github:NixOS/nixpkgs;
  };

If 'uri' is omitted, than the flake is a lookup in the flake registry, e.g.

  inputs = {
    nixpkgs = {};
  };

but in that case, you can also just omit the input altogether and
specify it as an argument to the 'outputs' function, as in

  outputs = { self, nixpkgs }: ...

This also gets rid of 'nonFlakeInputs', which are now just a special
kind of input that have a 'flake = false' attribute, e.g.

  inputs = {
    someRepo = {
      uri = github:example/repo;
      flake = false;
    };
  };
This commit is contained in:
Eelco Dolstra 2019-08-30 16:27:51 +02:00
parent 0588d72286
commit 30ccf4e52d
7 changed files with 136 additions and 220 deletions

View file

@ -58,14 +58,20 @@ struct SourceInfo
SourceInfo(const FlakeRef & resolvRef) : resolvedRef(resolvRef) {};
};
struct FlakeInput
{
FlakeRef ref;
bool isFlake = true;
FlakeInput(const FlakeRef & ref) : ref(ref) {};
};
struct Flake
{
FlakeId id;
FlakeRef originalRef;
std::string description;
SourceInfo sourceInfo;
std::vector<FlakeRef> inputs;
std::map<FlakeAlias, FlakeRef> nonFlakeInputs;
std::map<FlakeId, FlakeInput> inputs;
Value * vOutputs; // FIXME: gc
unsigned int edition;
@ -73,14 +79,6 @@ struct Flake
: originalRef(origRef), sourceInfo(sourceInfo) {};
};
struct NonFlake
{
FlakeRef originalRef;
SourceInfo sourceInfo;
NonFlake(const FlakeRef & origRef, const SourceInfo & sourceInfo)
: originalRef(origRef), sourceInfo(sourceInfo) {};
};
Flake getFlake(EvalState &, const FlakeRef &);
/* If 'allowLookup' is true, then resolve 'flakeRef' using the
@ -108,7 +106,7 @@ ResolvedFlake resolveFlake(EvalState &, const FlakeRef &, HandleLockFile);
void callFlake(EvalState & state,
const Flake & flake,
const FlakeInputs & inputs,
const LockedInputs & inputs,
Value & v);
void callFlake(EvalState & state,