aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-07-11 13:54:53 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-07-11 13:54:53 +0200
commitad42a784690449873fccb20192bd2150da81c56d (patch)
treeff61b5a0416ff45a74d02301da549ae1f5df5ebf /src/libexpr
parent4205234f26211baa787fd18de0256622759fea8a (diff)
Rename 'epoch' -> 'edition'
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/flake/flake.cc26
-rw-r--r--src/libexpr/flake/flake.hh2
2 files changed, 17 insertions, 11 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc
index 4f59c61bd..8b9525680 100644
--- a/src/libexpr/flake/flake.cc
+++ b/src/libexpr/flake/flake.cc
@@ -223,16 +223,21 @@ Flake getFlake(EvalState & state, const FlakeRef & flakeRef)
state.forceAttrs(vInfo);
- auto sEpoch = state.symbols.create("epoch");
-
- if (auto epoch = vInfo.attrs->get(sEpoch)) {
- flake.epoch = state.forceInt(*(**epoch).value, *(**epoch).pos);
- if (flake.epoch < 201906)
- throw Error("flake '%s' has illegal epoch %d", flakeRef, flake.epoch);
- if (flake.epoch > 201906)
- throw Error("flake '%s' requires unsupported epoch %d; please upgrade Nix", flakeRef, flake.epoch);
+ auto sEdition = state.symbols.create("edition");
+ auto sEpoch = state.symbols.create("epoch"); // FIXME: remove soon
+
+ auto edition = vInfo.attrs->get(sEdition);
+ if (!edition)
+ edition = vInfo.attrs->get(sEpoch);
+
+ if (edition) {
+ flake.edition = state.forceInt(*(**edition).value, *(**edition).pos);
+ if (flake.edition < 201906)
+ throw Error("flake '%s' has illegal edition %d", flakeRef, flake.edition);
+ if (flake.edition > 201906)
+ throw Error("flake '%s' requires unsupported edition %d; please upgrade Nix", flakeRef, flake.edition);
} else
- throw Error("flake '%s' lacks attribute 'epoch'", flakeRef);
+ throw Error("flake '%s' lacks attribute 'edition'", flakeRef);
if (auto name = vInfo.attrs->get(state.sName))
flake.id = state.forceStringNoCtx(*(**name).value, *(**name).pos);
@@ -271,7 +276,8 @@ Flake getFlake(EvalState & state, const FlakeRef & flakeRef)
throw Error("flake '%s' lacks attribute 'outputs'", flakeRef);
for (auto & attr : *vInfo.attrs) {
- if (attr.name != sEpoch &&
+ if (attr.name != sEdition &&
+ attr.name != sEpoch &&
attr.name != state.sName &&
attr.name != state.sDescription &&
attr.name != sInputs &&
diff --git a/src/libexpr/flake/flake.hh b/src/libexpr/flake/flake.hh
index de0feb2c4..01fb421bd 100644
--- a/src/libexpr/flake/flake.hh
+++ b/src/libexpr/flake/flake.hh
@@ -67,7 +67,7 @@ struct Flake
std::vector<FlakeRef> inputs;
std::map<FlakeAlias, FlakeRef> nonFlakeInputs;
Value * vOutputs; // FIXME: gc
- unsigned int epoch;
+ unsigned int edition;
Flake(const FlakeRef & origRef, const SourceInfo & sourceInfo)
: originalRef(origRef), sourceInfo(sourceInfo) {};