{ config, lib, pkgs, ... }:

let
  # TODO: Move to a fucking utility library already!
  listNixFilesInDirectory = dir:
    builtins.attrNames
      (lib.filterAttrs
        (k: _v: lib.hasSuffix ".nix" k)
        (builtins.readDir dir));
in {
  imports =
    (builtins.concatMap
      (user:
        builtins.map
          (module:
            ./users/${user}/${module})
          (listNixFilesInDirectory ./users/${user}))
      (builtins.attrNames (builtins.readDir ./users)));
}
