{
  self,
  nixpkgs,
  dream2nix,
  fenix,
  system,
  ...
}: let
  inherit (nixpkgs.legacyPackages.${system}) runCommandLocal yj;

  rust-toolchain = fenix.packages.${system}.stable;
in
  dream2nix.lib.makeFlakeOutputs {
    systems = [system];
    config.projectRoot = self;
    projects = ../projects.toml;

    source = runCommandLocal "source" {nativeBuildInputs = [yj];} ''
      cp -r ${self} $out/
      chmod -R u+w $out
      yj < $out/templates/package.yaml > $out/templates/package.json
    '';

    packageOverrides = {
      tlaternet-webserver.set-toolchain.overrideRustToolchain = old: {
        cargo = rust-toolchain.minimalToolchain;
        rustc = rust-toolchain.minimalToolchain;
      };

      tlaternet-webserver-deps.set-toolchain.overrideRustToolchain = old: {
        cargo = rust-toolchain.minimalToolchain;
        rustc = rust-toolchain.minimalToolchain;
      };

      tlaternet = {
        install-only-dist = {
          installPhase = ''
            cp -r $nodeModules/tlaternet/dist $out
          '';
        };
      };

      sharp = {
        add-libvips = {
          buildInputs = old:
            old
            ++ (with nixpkgs.legacyPackages.${system}; [
              vips
              pkg-config
            ]);
        };
      };
    };
  }
  // {
    inherit rust-toolchain;
  }
