about summary refs log tree commit diff
path: root/lib/mk_home.nix
blob: d41678757f9c0b2093a2454e649239b4068e9dc7 (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
31
32
33
{ self, home-manager, unstable, ... } @ inputs:
{
  mkHome = { username, hostname, pkgs, version, extraModules ? null }:
    let
      entrypoint = "${self}/home/configs/${hostname}/${username}.nix";
      defaultModule = { lib, config, ... }: {
        _module.args.inputs = self.inputs;
        _module.args.self = self;

        manual = {
          html.enable = false;
          manpages.enable = false;
          json.enable = false;
        };

        home = {
          inherit username;
          homeDirectory = "/home/${username}";
          stateVersion = version;
        };
      };
    in
    home-manager.lib.homeManagerConfiguration {
      pkgs = pkgs;
      modules = [
        defaultModule
        entrypoint
      ] ++ pkgs.lib.optionals (extraModules != null) extraModules;
    };

  mkHydraFromHomeConfigurations = conf:
    unstable.lib.mapAttrs' (name: value: { name = "home-${name}"; value = value.activationPackage; }) conf;
}