aboutsummaryrefslogtreecommitdiff
path: root/modules/default.nix
blob: 49f08c574bb9f8c27cee8b42832f448c12ed3d46 (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
{ inputs }:
let
  genModules =
    { type, modules }: builtins.map (module: "${inputs.self}/modules/${type}/${module}") modules;

  mkModules = moduleAttrList: builtins.concatMap (moduleAttr: genModules moduleAttr) moduleAttrList;
in
{
  mkSystem = hostname: system: nixpkgsVersion: modules: {
    ${hostname} = nixpkgsVersion.lib.nixosSystem {
      inherit system;
      modules = (mkModules modules) ++ [
        "${inputs.self}/hosts/${hostname}"
        "${inputs.self}/modules/users"
        inputs.home-manager.nixosModules.home-manager
        inputs.agenix.nixosModules.default
      ];
      specialArgs = { inherit inputs; };
    };
  };

  mergeSets = inputs.nixpkgs.lib.lists.foldl' (
    x: y: inputs.nixpkgs.lib.attrsets.recursiveUpdate x y
  ) { };
}