How to install a previous version of a specific package with configuration.nix?

Here’s how I did it in a package (NOTE: this isn’t fully working yet, but the previous version is):

{
  lib,
  makeWrapper,
  buildGoModule,
  fetchFromGitHub,
  pulumi-bin,
  nodejs_20,
  esbuild,
  system,
}: let
  # Fetch the specific version of nixpkgs
  specificPkgs =
    import (builtins.fetchTarball {
      # URL to the tarball of the specific nixpkgs commit
      # Choose the right version for bun using https://lazamar.co.uk/nix-versions/?channel=nixpkgs-unstable&package=bun
      url = "https://github.com/NixOS/nixpkgs/archive/e89cf1c932006531f454de7d652163a9a5c86668.tar.gz";
      sha256 = "sha256:09cbqscrvsd6p0q8rswwxy7pz1p1qbcc8cdkr6p6q8sx0la9r12c";
    }) {
      inherit system;
    };

  # Use bun from the specific nixpkgs version
  bun = specificPkgs.bun;
in
  buildGoModule rec {
...
    buildInputs = [makeWrapper pulumi-bin bun nodejs_20 esbuild];
...