{ 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 ( if name == "d2" then { d2plugin-tala = mkPackage pkgs' "d2plugin-tala"; } else { } ); mkApp = drv: flake-utils.lib.mkApp { inherit drv; }; mkOverlay = name: final: prev: final.setAttrByPath [ name ] (mkPackage name prev); allPackageNames = [ "d2" "d2plugin-tala" ]; 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; }; basePackages = mkAllPackages pkgs; packages = with basePackages; { d2full = d2.override { withTala = true; }; } // basePackages; in { check = packages; inherit packages; apps = mapAttrs (name: mkApp) packages; }); }