Referencing of Path in Generated Configuration

Hello! I want to generate a recursive configuration and
would like to know how something like that can be possible:

let
config = path: {
key =  path;
}
yaml = lib.fix (path: (pkgs.formats.yaml {}).generate "cfg.yml" {inherit (config path)});
in
program = "${pkgs.program}  --config ${yaml}"

I want to reference the output path in the configuration itself.