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
+3 -8
View File
@@ -217,25 +217,20 @@ void makeFlakeClosureGCRoot(Store & store,
assert(store.isValidPath(resFlake.flake.sourceInfo.storePath));
closure.insert(resFlake.flake.sourceInfo.storePath);
std::queue<std::reference_wrapper<const flake::FlakeInputs>> queue;
std::queue<std::reference_wrapper<const flake::LockedInputs>> queue;
queue.push(resFlake.lockFile);
while (!queue.empty()) {
const flake::FlakeInputs & flake = queue.front();
const flake::LockedInputs & flake = queue.front();
queue.pop();
/* Note: due to lazy fetching, these paths might not exist
yet. */
for (auto & dep : flake.flakeInputs) {
for (auto & dep : flake.inputs) {
auto path = dep.second.computeStorePath(store);
if (store.isValidPath(path))
closure.insert(path);
queue.push(dep.second);
}
for (auto & dep : flake.nonFlakeInputs) {
auto path = dep.second.computeStorePath(store);
if (store.isValidPath(path))
closure.insert(path);
}
}
if (closure.empty()) return;