Accessing attribute set declared in multi-file configuration

The problem

I am using nvf to declare my Neovim config. I want to share the same configuration between a standalone instance to use on my ARM laptop which unfortunately does not use NixOS or Home Manager, and a Home Manager module to use on my desktop. To solve this, I wrote the following flake.

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-parts.url = "github:hercules-ci/flake-parts";
    home-manager.url = "github:nix-community/home-manager";
    nvf.url = "github:notashelf/nvf";
  };

  outputs =
    inputs@{ flake-parts, ... }:
    let
      conf = ./configuration.nix;
    in
    flake-parts.lib.mkFlake { inherit inputs; } {
      imports = [
        inputs.home-manager.flakeModules.home-manager
      ];
      systems = [
        "x86_64-linux"
        "aarch64-linux"
      ];
      perSystem =
        { pkgs, ... }:
        {
          packages.default =
            (inputs.nvf.lib.neovimConfiguration {
              pkgs = pkgs;
              modules = [ conf ];
            }).neovim;
        };
      flake = {
        homeModules.default =
          { lib, ... }:
          {
            imports = [ inputs.nvf.homeManagerModules.default ];
            config = {
              programs.nvf.settings = (import conf).config;
            };
          };
      };
    };

This worked fine, until I wanted to separate the nvf config into multiple files, with an entry point that simply imports the rest of the configuration. Now, I quite reasonably run into the issue that the config attribute is not declared in the entry point file.

The question

How do I access the attribute set config, to pass it to programs.nvf.settings, given the multi-file import structure. If this is not within Nix best practices, is there a better approach? Help is much appreciated!

Share the actual code and error. Paraphrasing will not help us help you.

You can also review https://nixos.org/manual/nixos/stable/#sec-writing-modules.

Of course, here is the structure of the config.

config
├── default.nix
├── lang
│   ├── default.nix
│   ├── lang.nix
│   └── lsp.nix
├── opts.nix
└── ui.nix

The entry point to the configuration (config/default.nix) contains the following:

{
  imports = [
    ./opts.nix
    ./ui.nix
    ./lang
  ];
}

The other default.nix file similarly simply imports the files in config/lang. The other files are structured as follows:

{
  config.vim = {
    <nvf config here>
  }
}

I don’t think their exact contents further than this are important. Upon attempting to rebuild with this, still using the flake I show in my initial post (with the change conf = "./configuration.nix" -> conf = "./config"), I get the following error

error: attribute 'config' missing
at /nix/store/8nss2ffpdyga9iv9avm500kdm4p8p1db-source/flake.nix:37:39:
    36|             config = {
    37|               programs.nvf.settings = (import conf).config;
      |                                       ^
    38|             };

It seems that import conf is not evaluating the imports in config/default.nix before concluding that it does not contain the attribute config. How to work around this? I already tried evaluating with lib.evalModule, but this also did not work. The optimal goal of this is to simply set some new default values in programs.nvf.settings for the nvf Home Manager module according to the config described above.