{ pkgs, lib, config, inputs, system, sources, ... }:
let cfg = config.mods;

in {
  options.mods.home.file =
    lib.mkOption { description = "home-manager configuration file"; };

  config = {
    home-manager = {
      extraSpecialArgs = { inherit system pkgs inputs sources; };
      users."${cfg.user.name}" = {
        imports =
          [ cfg.home.file inputs.self.outputs.homeManagerModules.default ];
      };
      backupFileExtension = "bak";
    };
  };
}
