{ inputs = { flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, flake-utils, ... }: let inherit (builtins) listToAttrs mapAttrs; mkPackage = pkgs: name: pkgs.callPackage ./pkgs/${name}.nix { }; mkApp = drv: flake-utils.lib.mkApp { inherit drv; }; mkOverlay = name: final: prev: final.setAttrByPath [ name ] (mkPackage name prev); allPackageNames = [ "d2" "d2_unstable" ]; mkAllPackages = pkgs': listToAttrs (map (name: { inherit name; value = mkPackage pkgs' name; }) allPackageNames); in { overlays = (listToAttrs (map (name: { inherit name; value = mkOverlay name; }) allPackageNames ) ) // { all = final: prev: mkAllPackages prev; }; } // flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; packages = mkAllPackages pkgs; in { check = packages; inherit packages; apps = mapAttrs (name: mkApp) packages; }); }