From e5ea01c1a8bbd328dcc576928bf3e4271cb55399 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 10 Apr 2020 10:24:09 +0200 Subject: Remove flake 'edition' field Future editions of flakes or the Nix language can be supported by renaming flake.nix (e.g. flake-v2.nix). This avoids a bootstrap problem where we don't know which grammar to use to parse flake*.nix. It also allows a project to support multiple flake editions, in theory. --- src/libexpr/flake/call-flake.nix | 1 - src/libexpr/flake/flake.cc | 20 ++++++-------------- src/libexpr/flake/flake.hh | 1 - 3 files changed, 6 insertions(+), 16 deletions(-) (limited to 'src/libexpr') diff --git a/src/libexpr/flake/call-flake.nix b/src/libexpr/flake/call-flake.nix index dc9ed357c..8ee17b8f4 100644 --- a/src/libexpr/flake/call-flake.nix +++ b/src/libexpr/flake/call-flake.nix @@ -19,7 +19,6 @@ let result = outputs // sourceInfo // { inherit inputs; inherit outputs; inherit sourceInfo; }; in if node.flake or true then - assert flake.edition or flake.epoch or 0 == 201909; assert builtins.isFunction flake.outputs; result else diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc index 86bb05b5d..212eceeac 100644 --- a/src/libexpr/flake/flake.cc +++ b/src/libexpr/flake/flake.cc @@ -231,22 +231,14 @@ static Flake getFlake( expectType(state, tAttrs, vInfo, Pos(state.symbols.create(flakeFile), 0, 0)); - auto sEdition = state.symbols.create("edition"); + auto sEdition = state.symbols.create("edition"); // FIXME: remove soon auto sEpoch = state.symbols.create("epoch"); // FIXME: remove soon - auto edition = vInfo.attrs->get(sEdition); - if (!edition) - edition = vInfo.attrs->get(sEpoch); - - if (edition) { - expectType(state, tInt, *edition->value, *edition->pos); - flake.edition = edition->value->integer; - if (flake.edition > 201909) - throw Error("flake '%s' requires unsupported edition %d; please upgrade Nix", lockedRef, flake.edition); - if (flake.edition < 201909) - throw Error("flake '%s' has illegal edition %d", lockedRef, flake.edition); - } else - throw Error("flake '%s' lacks attribute 'edition'", lockedRef); + if (vInfo.attrs->get(sEdition)) + warn("flake '%s' has deprecated attribution 'edition'", lockedRef); + + if (vInfo.attrs->get(sEpoch)) + warn("flake '%s' has deprecated attribution 'epoch'", lockedRef); if (auto description = vInfo.attrs->get(state.sDescription)) { expectType(state, tString, *description->value, *description->pos); diff --git a/src/libexpr/flake/flake.hh b/src/libexpr/flake/flake.hh index 7ee9bbe76..107498c1b 100644 --- a/src/libexpr/flake/flake.hh +++ b/src/libexpr/flake/flake.hh @@ -34,7 +34,6 @@ struct Flake std::shared_ptr sourceInfo; FlakeInputs inputs; Value * vOutputs; // FIXME: gc - unsigned int edition; ~Flake(); }; -- cgit v1.2.3