Made epochs more fine-grained

Fixes #2894
This commit is contained in:
Nick Van den Broeck 2019-06-03 14:47:47 +02:00
parent 507c150034
commit d9a6a75ed2
5 changed files with 11 additions and 11 deletions

View file

@ -96,7 +96,7 @@ module.
# The epoch may be used in the future to determine how Nix
# expressions inside this flake are to be parsed.
epoch = 2018;
epoch = 201906;
# Some other metadata.
description = "A filesystem that fetches DWARF debug info from the Internet on demand";
@ -164,7 +164,7 @@ Similarly, a minimal `flake.nix` for Nixpkgs:
{
name = "nixpkgs";
epoch = 2018;
epoch = 201906;
description = "A collection of packages for the Nix package manager";

View file

@ -3,7 +3,7 @@
description = "The purely functional package manager";
epoch = 2019;
epoch = 201906;
inputs = [ "nixpkgs" ];

View file

@ -312,7 +312,7 @@ Flake getFlake(EvalState & state, const FlakeRef & flakeRef, bool impureIsAllowe
if (auto epoch = vInfo.attrs->get(sEpoch)) {
flake.epoch = state.forceInt(*(**epoch).value, *(**epoch).pos);
if (flake.epoch > 2019)
if (flake.epoch > 201906)
throw Error("flake '%s' requires unsupported epoch %d; please upgrade Nix", flakeRef, flake.epoch);
} else
throw Error("flake '%s' lacks attribute 'epoch'", flakeRef);

View file

@ -3,7 +3,7 @@
description = "A flake for building Hello World";
epoch = 2019;
epoch = 201906;
requires = [ "nixpkgs" ];

View file

@ -29,7 +29,7 @@ cat > $flake1Dir/flake.nix <<EOF
{
name = "flake1";
epoch = 2019;
epoch = 201906;
description = "Bla bla";
@ -48,7 +48,7 @@ cat > $flake2Dir/flake.nix <<EOF
{
name = "flake2";
epoch = 2019;
epoch = 201906;
inputs = [ "flake1" ];
@ -67,7 +67,7 @@ cat > $flake3Dir/flake.nix <<EOF
{
name = "flake3";
epoch = 2019;
epoch = 201906;
inputs = [ "flake2" ];
@ -169,7 +169,7 @@ cat > $flake3Dir/flake.nix <<EOF
{
name = "flake3";
epoch = 2019;
epoch = 201906;
inputs = [ "flake1" "flake2" ];
@ -192,7 +192,7 @@ nix build -o $TEST_ROOT/result --flake-registry $registry $flake3Dir:sth
[[ ! (-z $(git -C $flake3Dir diff master)) ]]
# Unsupported epochs should be an error.
sed -i $flake3Dir/flake.nix -e s/2019/2030/
sed -i $flake3Dir/flake.nix -e s/201906/201909/
nix build -o $TEST_ROOT/result --flake-registry $registry $flake3Dir:sth 2>&1 | grep 'unsupported epoch'
# Test whether registry caching works.
@ -219,7 +219,7 @@ cat > $flake3Dir/flake.nix <<EOF
{
name = "flake3";
epoch = 2019;
epoch = 201906;
inputs = [ "flake1" "flake2" ];