aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-04-10 10:24:09 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-04-10 10:24:09 +0200
commite5ea01c1a8bbd328dcc576928bf3e4271cb55399 (patch)
tree988accdc0e9ad763ea6b3c24df12154a286e1a55 /src/libexpr
parent3aaceeb7e2d3fb8a07a1aa5a21df1dca6bbaa0ef (diff)
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.
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/flake/call-flake.nix1
-rw-r--r--src/libexpr/flake/flake.cc20
-rw-r--r--src/libexpr/flake/flake.hh1
3 files changed, 6 insertions, 16 deletions
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<const fetchers::Tree> sourceInfo;
FlakeInputs inputs;
Value * vOutputs; // FIXME: gc
- unsigned int edition;
~Flake();
};