summaryrefslogtreecommitdiff
path: root/modules/sys/core/home-manager.nix
blob: 06f909f66668cee4990b94681d49a551fc807052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{ config, lib, inputs, ... }:
{
  options.szpont.home-manager = {
    enable = lib.mkEnableOption "Home Manager configuration manager";

    users = lib.mkOption {
      default = {};
      description = "Attribute set of users and their home-manager configurations";
      type = lib.types.attrsOf (lib.types.submodule {
        options = {
          path = lib.mkOption {
            type = lib.types.path;
            description = "Path to the user's home.nix file";
          };
        };
      });
    };
  };

  config = lib.mkIf config.szpont.home-manager.enable {
    home-manager = {
      extraSpecialArgs = { inherit inputs; };
      useGlobalPkgs = true;
      useUserPackages = true;
      backupFileExtension = "bak";

      users = lib.mapAttrs (name: user: import user.path) config.szpont.home-manager.users;
    };
  };
}