{ lib, ... }: { nixpkgs.overlays = [ ( final: prev: builtins.listToAttrs ( map (pkg: { name = pkg; value = let argsPath = ./${pkg}/args.nix; in final.callPackage ./${pkg} ( if (builtins.pathExists argsPath) then (import argsPath final) else { } ); }) (builtins.attrNames (builtins.readDir ./.)) ) ) ]; imports = lib.pipe ./. [ builtins.readDir (lib.filterAttrs (n: ty: ty == "directory" && builtins.pathExists ./${n}/nixos.nix)) (lib.mapAttrsToList (n: _: ./${n}/nixos.nix)) ]; }