aboutsummaryrefslogtreecommitdiff
path: root/modules/default.nix
blob: bfa17604e216f658362ae0154f8112fd002273bb (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
{ 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: nixpkgsVersion: modules: {
    ${hostname} = nixpkgsVersion.lib.nixosSystem {
      system = "x86_64-linux";
      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
  ) { };
}