From 80c36d4562af71a90c67b3adb886a1003834890e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 30 Aug 2019 16:38:27 +0200 Subject: [PATCH] Remove 'name' attribute from flakes This is no longer needed since flakes are given an identity in the 'inputs' attribute. --- flake.lock | 7 ++----- flake.nix | 2 -- src/libexpr/flake/flake.cc | 6 ------ src/libexpr/flake/flake.hh | 1 - src/nix/flake.cc | 11 ----------- tests/flakes.sh | 20 ++++---------------- 6 files changed, 6 insertions(+), 41 deletions(-) diff --git a/flake.lock b/flake.lock index 8072152ca..fa5649c03 100644 --- a/flake.lock +++ b/flake.lock @@ -1,13 +1,10 @@ { "inputs": { "nixpkgs": { - "id": "nixpkgs", "inputs": {}, - "narHash": "sha256-AndIaZrFFIT+VFhVtQHsS90I5SWfjTDTxzs9Hx9ZxZA=", - "nonFlakeInputs": {}, - "uri": "github:edolstra/nixpkgs/9bd2e2c96ddeec64e9ad37540412263fdb78458d" + "narHash": "sha256-TrLhI3xPkTTznE9gcMHhkHirGNN7N02zM4DxJ/U3WRs=", + "uri": "github:edolstra/nixpkgs/24bf27fc215e8300877dfa1c426b9966bbfbd150" } }, - "nonFlakeInputs": {}, "version": 2 } diff --git a/flake.nix b/flake.nix index 9f7d6b2ee..06a5515c5 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,4 @@ { - name = "nix"; - description = "The purely functional package manager"; edition = 201909; diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index ce5dd55a2..ba337cf97 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -239,11 +239,6 @@ Flake getFlake(EvalState & state, const FlakeRef & flakeRef) } else throw Error("flake '%s' lacks attribute 'edition'", flakeRef); - if (auto name = vInfo.attrs->get(state.sName)) - flake.id = state.forceStringNoCtx(*(**name).value, *(**name).pos); - else - throw Error("flake '%s' lacks attribute 'name'", flakeRef); - if (auto description = vInfo.attrs->get(state.sDescription)) flake.description = state.forceStringNoCtx(*(**description).value, *(**description).pos); @@ -292,7 +287,6 @@ Flake getFlake(EvalState & state, const FlakeRef & flakeRef) for (auto & attr : *vInfo.attrs) { if (attr.name != sEdition && attr.name != sEpoch && - attr.name != state.sName && attr.name != state.sDescription && attr.name != sInputs && attr.name != sOutputs) diff --git a/src/libexpr/flake/flake.hh b/src/libexpr/flake/flake.hh index 84bce9b5a..8f05e9799 100644 --- a/src/libexpr/flake/flake.hh +++ b/src/libexpr/flake/flake.hh @@ -67,7 +67,6 @@ struct FlakeInput struct Flake { - FlakeId id; FlakeRef originalRef; std::string description; SourceInfo sourceInfo; diff --git a/src/nix/flake.cc b/src/nix/flake.cc index aab29b626..4129ef323 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -103,7 +103,6 @@ static void sourceInfoToJson(const SourceInfo & sourceInfo, nlohmann::json & j) static void printFlakeInfo(const Flake & flake) { - std::cout << fmt("ID: %s\n", flake.id); std::cout << fmt("Description: %s\n", flake.description); std::cout << fmt("Edition: %s\n", flake.edition); printSourceInfo(flake.sourceInfo); @@ -112,7 +111,6 @@ static void printFlakeInfo(const Flake & flake) static nlohmann::json flakeToJson(const Flake & flake) { nlohmann::json j; - j["id"] = flake.id; j["description"] = flake.description; j["edition"] = flake.edition; sourceInfoToJson(flake.sourceInfo, j); @@ -120,12 +118,6 @@ static nlohmann::json flakeToJson(const Flake & flake) } #if 0 -static void printNonFlakeInfo(const NonFlake & nonFlake) -{ - std::cout << fmt("ID: %s\n", nonFlake.alias); - printSourceInfo(nonFlake.sourceInfo); -} - // FIXME: merge info CmdFlakeInfo? struct CmdFlakeDeps : FlakeCommand { @@ -148,9 +140,6 @@ struct CmdFlakeDeps : FlakeCommand auto resFlake = std::move(todo.front()); todo.pop(); - for (auto & nonFlake : resFlake.nonFlakeDeps) - printNonFlakeInfo(nonFlake); - for (auto & info : resFlake.flakeDeps) { printFlakeInfo(info.second.flake); todo.push(info.second); diff --git a/tests/flakes.sh b/tests/flakes.sh index 7c16304ec..8594a4c55 100644 --- a/tests/flakes.sh +++ b/tests/flakes.sh @@ -29,8 +29,6 @@ done cat > $flake1Dir/flake.nix < $flake2Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix < $flake3Dir/flake.nix <