Derivation in flake templates

hello, anyone know why derivations in flake templates are not evaluated?

Consider the following code:

{
  outputs = { self, nixpkgs }:
    let
      pkgs = import nixpkgs { system = "x86_64-linux"; };
      templatePackage = pkgs.stdenv.mkDerivation {
        name = "foo-template-package";
        src = ./.;
        installPhase = ''
          mkdir -p $out
          echo yo > $out/foo
        '';
      };
    in
    {
      templates = {
        foo = {
          path = "${templatePackage}";
        };
      };
    };
}

Calling nix flake init -t ".#foo" gives me the following error:

error: opening directory '/nix/store/<some-hash>-foo-template-package': No such file or directory

Looks like the path is expected to be just a directory to be copied. Which doesn’t explain why what you’re trying to do doesn’t work. :person_shrugging:

exactly. funnily enough, the wiki states that the path is a <store-path> which makes this even more puzzling