# SPDX-FileCopyrightText: 2021 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0

{ depot, lib, pkgs, ... }@args:
let
  cfg = configName: configPath: { ... }: {
    _module.args = args // {
      inherit configName;
    };
    imports = [ configPath ];
  };

  configs = {
    base = nixos/lib/home-manager/common.nix;
    client = nixos/lib/home-manager/client.nix;
  };

  configModules = lib.mapAttrs cfg configs;

  builtModules = lib.mapAttrs (name: value: (import ../third_party/home-manager/modules {
    inherit pkgs;

    configuration = value;
    check = true;
  }).activationPackage) configModules;
in
configModules // {
  built = builtModules;
}