{ inputs, ... }: let inherit (inputs) nixpkgs; inherit (nixpkgs) lib; in { configurations = lib.mapAttrs (dir: _: let inherit (import ./machines/${dir}/sysidentity.nix) sysidentity; package-modules = lib.mapAttrsToList (_: module: module) (lib.filterAttrs (name: _: (lib.hasInfix "_" name) -> (lib.hasPrefix (sysidentity.type + "_") name)) (import ./packages)); inputs-overlays = lib.mapAttrs (_: nixpkgs: nixpkgs.legacyPackages.${sysidentity.arch}) (lib.filterAttrs (name: _: lib.hasPrefix "nixpkgs-" name) inputs); in lib.nixosSystem { system = sysidentity.arch; modules = [ ./machines/${dir}/hardware-configuration.nix ./configuration.nix ({ ... }: { networking.hostName = sysidentity.name; nixpkgs.overlays = [ (_: _: inputs-overlays) ]; }) ] ++ (if lib.pathIsRegularFile ./machines/${dir}/configuration.nix then [ ./machines/${dir}/configuration.nix ] else []) ++ package-modules; }) (lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./machines)); }