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!