Pass a flake to itself as "self"

This commit is contained in:
Eelco Dolstra 2019-04-16 16:29:44 +02:00
parent 3ddb6d1833
commit 939bee06cd
2 changed files with 8 additions and 4 deletions

View file

@ -3,13 +3,15 @@
description = "The purely functional package manager"; description = "The purely functional package manager";
requires = [ flake:nixpkgs ]; epoch = 2019;
provides = flakes: rec { requires = [ "nixpkgs" ];
provides = deps: rec {
hydraJobs = import ./release.nix { hydraJobs = import ./release.nix {
nix = flakes.nix; # => flakes.self? nix = deps.self;
nixpkgs = flakes.nixpkgs; nixpkgs = deps.nixpkgs;
}; };
packages.nix = hydraJobs.build.x86_64-linux; packages.nix = hydraJobs.build.x86_64-linux;

View file

@ -441,6 +441,8 @@ void callFlake(EvalState & state, const Dependencies & flake, Value & v)
auto vProvides = state.allocAttr(v, state.symbols.create("provides")); auto vProvides = state.allocAttr(v, state.symbols.create("provides"));
mkApp(*vProvides, *flake.flake.vProvides, v); mkApp(*vProvides, *flake.flake.vProvides, v);
v.attrs->push_back(Attr(state.symbols.create("self"), &v));
v.attrs->sort(); v.attrs->sort();
} }