diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -285,9 +285,8 @@
 Stack aims to depend on well-known packages. The specific versions on which it
 depends at any time are specified by `package.yaml` and `stack.yaml`. It does
 not aim to be compatible with more than one version of the `Cabal` package at
-any time. At the time of writing (February 2024) the package versions are
-primarily ones in Stackage snapshot LTS Haskell 22.7 (for GHC 9.6.4), together
-with extra-deps to depend on the latest version of `pantry` and `process`.
+any time. At the time of writing (May 2024) the package versions are primarily
+ones in Stackage snapshot LTS Haskell 22.21 (for GHC 9.6.5).
 
 A Stack executable makes use of Cabal (the library) through a small 'Setup'
 executable that it compiles from Haskell source code. The executable compiles
@@ -607,7 +606,7 @@
 
 [Stan](https://hackage.haskell.org/package/stan) is a Haskell static analysis
 tool. As of `stan-0.1.0.1`, it supports GHC >= 9.6.3 and Stack is built with
-GHC 9.6.4. The tool is configured by the contents of the `.stan.toml` file.
+GHC 9.6.5. The tool is configured by the contents of the `.stan.toml` file.
 
 This workflow will run if:
 
diff --git a/ChangeLog.md b/ChangeLog.md
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,14 +1,45 @@
 # Changelog
 
-##  v2.15.5 - 2024-03-28
+## v2.15.7 - 2024-05-12
 
 Release notes:
 
 * This release fixes potential bugs.
+* The hash that Stack uses to distinguish one build plan from another has
+  changed for plans that set (as opposed to unset) manually Cabal flags for
+  immutable dependencies. This will cause Stack to rebuild dependencies for such
+  plans.
 
+**Changes since v2.15.5:**
+
+Major changes:
+
+* Stack 2.15.5 and earlier cannot build with Cabal (the library) version
+  `3.12.0.0`. Stack can now build with that Cabal version.
+
+Behavior changes:
+
+* Stack's `StackSetupShim` executable, when called with `repl` and
+  `stack-initial-build-steps`, no longer uses Cabal's `replHook` to apply
+  `initialBuildSteps` but takes a more direct approach.
+
+Bug fixes:
+
+* Fix a regression introduced in Stack 2.15.1 that caused a 'no operation'
+  `stack build` to be slower than previously.
+* The hashes that Stack uses to distinguish one build plan from another now
+  include the Cabal flags for immutable dependencies set manually. Previously,
+  in error, only such flags that were unset manually were included.
+
+## v2.15.5 - 2024-03-28
+
+Release notes:
+
+* This release fixes potential bugs.
+
 **Changes since v2.15.3:**
 
-Behaviour changes:
+Behavior changes:
 
 * Following the handover of the Stackage project to the Haskell Foundation, the
   default value of the `urls` key is
@@ -187,7 +218,8 @@
   precedence over the existing `casa-repo-prefix` key. The latter is deprecated.
   The new key also allows Stack's use of a Casa (content-addressable storage
   archive) server to be disabled and the maximum number of keys per request to
-  be configured. The defaults are unchanged.
+  be configured. The default Casa prefix references https://casa.stackage.org,
+  instead of https://casa.fpcomplete.com.
 * Add option `--progress-bar=<format>` to Stack's `build` command to configure
   the format of the progress bar, where `<format>` is one of `none`,
   `count-only` (only the package count), `capped` (capped to a length equal to
diff --git a/cabal.config b/cabal.config
--- a/cabal.config
+++ b/cabal.config
@@ -1,6 +1,6 @@
 constraints:
-  , Cabal ==3.10.1.0
-  , Cabal-syntax ==3.10.1.0
+  , Cabal ==3.10.3.0
+  , Cabal-syntax ==3.10.3.0
   , Glob ==0.10.2
   , OneTuple ==0.4.1.1
   , QuickCheck ==2.14.3
@@ -22,18 +22,18 @@
   , attoparsec-aeson ==2.1.0.0
   , attoparsec-iso8601 ==1.1.0.1
   , auto-update ==0.1.6
-  , base ==4.18.2.0
+  , base ==4.18.2.1
   , base-compat ==0.13.1
   , base-compat-batteries ==0.13.1
-  , base-orphans ==0.9.1
+  , base-orphans ==0.9.2
   , base16-bytestring ==1.0.2.0
   , base64-bytestring ==1.2.1.0
   , basement ==0.0.16
-  , bifunctors ==5.6.1
+  , bifunctors ==5.6.2
   , binary ==0.8.9.1
   , bitvec ==1.1.5.0
   , blaze-builder ==0.4.2.3
-  , blaze-html ==0.9.1.2
+  , blaze-html ==0.9.2.0
   , blaze-markup ==0.8.3.0
   , byteorder ==1.0.4
   , bytestring ==0.11.5.3
@@ -55,7 +55,7 @@
   , cryptohash-sha256 ==0.11.102.1
   , crypton ==0.34
   , crypton-conduit ==0.2.3
-  , crypton-connection ==0.3.1
+  , crypton-connection ==0.3.2
   , crypton-x509 ==1.7.6
   , crypton-x509-store ==1.6.9
   , crypton-x509-system ==1.6.7
@@ -63,8 +63,8 @@
   , data-default-class ==0.1.2.0
   , data-fix ==0.3.2
   , deepseq ==1.4.8.1
-  , digest ==0.0.2.0
-  , directory ==1.3.8.1
+  , digest ==0.0.2.1
+  , directory ==1.3.8.4
   , distributive ==0.6.2.1
   , dlist ==1.0
   , easy-file ==0.2.5
@@ -73,26 +73,26 @@
   , exceptions ==0.10.7
   , extra ==1.7.14
   , fast-logger ==3.2.2
-  , file-embed ==0.0.15.0
+  , file-embed ==0.0.16.0
   , filelock ==0.1.1.7
-  , filepath ==1.4.200.1
+  , filepath ==1.4.300.1
   , fsnotify ==0.4.1.0
   , generic-deriving ==1.14.5
   , generically ==0.1.1
   , ghc-bignum ==1.3
-  , ghc-boot ==9.6.4
-  , ghc-boot-th ==9.6.4
+  , ghc-boot ==9.6.5
+  , ghc-boot-th ==9.6.5
   , ghc-prim ==0.10.0
   , githash ==0.1.7.0
   , hackage-security ==0.6.2.4
-  , hashable ==1.4.3.0
+  , hashable ==1.4.4.0
   , hi-file-parser ==0.1.6.0
   , hinotify ==0.4.1
   , hourglass ==0.2.12
   , hpack ==0.36.0
   , hpc ==0.6.2.0
   , http-api-data ==0.5.1
-  , http-client ==0.7.16
+  , http-client ==0.7.17
   , http-client-tls ==0.3.6.3
   , http-conduit ==2.3.8.3
   , http-download ==0.2.1.0
@@ -104,7 +104,8 @@
   , integer-gmp ==1.1
   , integer-logarithms ==1.0.3.1
   , iproute ==1.7.12
-  , libyaml ==0.1.2
+  , libyaml ==0.1.4
+  , libyaml-clib ==0.2.5
   , lift-type ==0.1.1.1
   , lifted-base ==0.2.3.12
   , lukko ==0.1.1.3
@@ -112,13 +113,13 @@
   , memory ==0.18.0
   , microlens ==0.4.13.1
   , microlens-mtl ==0.2.0.3
-  , microlens-th ==0.4.3.14
+  , microlens-th ==0.4.3.15
   , mime-types ==0.1.2.0
   , mintty ==0.1.4
   , monad-control ==1.0.3.1
   , monad-logger ==0.3.40
   , monad-loops ==0.4.3
-  , mono-traversable ==1.0.15.3
+  , mono-traversable ==1.0.17.0
   , mtl ==2.3.1
   , mtl-compat ==0.2.2
   , mustache ==2.4.2
@@ -130,6 +131,7 @@
   , open-browser ==0.2.1.0
   , optparse-applicative ==0.18.1.0
   , optparse-simple ==0.1.1.4
+  , os-string ==2.0.2.1
   , pantry ==0.9.3.2
   , parsec ==3.1.16.1
   , parser-combinators ==1.3.0
@@ -137,16 +139,16 @@
   , path-io ==1.8.1
   , path-pieces ==0.2.1
   , pem ==0.2.4
-  , persistent ==2.14.6.0
+  , persistent ==2.14.6.1
   , persistent-sqlite ==2.13.3.0
   , persistent-template ==2.12.0.0
   , pretty ==1.1.3.6
   , prettyprinter ==1.7.1
   , prettyprinter-ansi-terminal ==1.1.3
   , primitive ==0.8.0.0
-  , process ==1.6.18.0
+  , process ==1.6.19.0
   , project-template ==0.2.1.0
-  , random ==1.2.1.1
+  , random ==1.2.1.2
   , resource-pool ==0.4.0.0
   , resourcet ==1.3.0
   , retry ==0.9.3.1
@@ -158,12 +160,12 @@
   , safe-exceptions ==0.1.7.4
   , scientific ==0.3.7.0
   , semialign ==1.3
-  , semigroupoids ==6.0.0.1
+  , semigroupoids ==6.0.1
   , silently ==1.2.5.3
   , socks ==0.6.1
   , split ==0.2.5
   , splitmix ==0.1.0.5
-  , stack ==2.15.5
+  , stack ==2.15.7
   , static-bytes ==0.1.0
   , stm ==2.5.1.0
   , stm-chans ==3.0.0.9
@@ -178,7 +180,7 @@
   , text-metrics ==0.3.2
   , text-short ==0.1.5
   , th-abstraction ==0.5.0.0
-  , th-compat ==0.1.4
+  , th-compat ==0.1.5
   , th-lift ==0.8.4
   , th-lift-instances ==0.1.20
   , these ==1.2
@@ -191,7 +193,7 @@
   , typed-process ==0.2.11.1
   , unix ==2.8.4.0
   , unix-compat ==0.7.1
-  , unix-time ==0.4.11
+  , unix-time ==0.4.12
   , unliftio ==0.2.25.0
   , unliftio-core ==0.2.1.0
   , unordered-containers ==0.2.20
@@ -202,5 +204,5 @@
   , vector-stream ==0.1.0.1
   , witherable ==0.4.2
   , yaml ==0.11.11.2
-  , zip-archive ==0.4.3
+  , zip-archive ==0.4.3.2
   , zlib ==0.6.3.0
diff --git a/cabal.project b/cabal.project
--- a/cabal.project
+++ b/cabal.project
@@ -33,8 +33,8 @@
 -- specified by the snapshot specifed in Stack's project-level YAML
 -- configuration file (`stack.yaml`). The relevant version of GHC can be
 -- confirmed by reviewing the snapshot on Stackage. For example, at:
--- https://www.stackage.org/lts-22.7/cabal.config.
+-- https://www.stackage.org/lts-22.21/cabal.config.
 --
-with-compiler: ghc-9.6.4
+with-compiler: ghc-9.6.5
 import: cabal.config
 packages: .
diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md
--- a/doc/CONTRIBUTING.md
+++ b/doc/CONTRIBUTING.md
@@ -285,9 +285,8 @@
 Stack aims to depend on well-known packages. The specific versions on which it
 depends at any time are specified by `package.yaml` and `stack.yaml`. It does
 not aim to be compatible with more than one version of the `Cabal` package at
-any time. At the time of writing (February 2024) the package versions are
-primarily ones in Stackage snapshot LTS Haskell 22.7 (for GHC 9.6.4), together
-with extra-deps to depend on the latest version of `pantry` and `process`.
+any time. At the time of writing (May 2024) the package versions are primarily
+ones in Stackage snapshot LTS Haskell 22.21 (for GHC 9.6.5).
 
 A Stack executable makes use of Cabal (the library) through a small 'Setup'
 executable that it compiles from Haskell source code. The executable compiles
@@ -607,7 +606,7 @@
 
 [Stan](https://hackage.haskell.org/package/stan) is a Haskell static analysis
 tool. As of `stan-0.1.0.1`, it supports GHC >= 9.6.3 and Stack is built with
-GHC 9.6.4. The tool is configured by the contents of the `.stan.toml` file.
+GHC 9.6.5. The tool is configured by the contents of the `.stan.toml` file.
 
 This workflow will run if:
 
diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md
--- a/doc/ChangeLog.md
+++ b/doc/ChangeLog.md
@@ -1,14 +1,45 @@
 # Changelog
 
-##  v2.15.5 - 2024-03-28
+## v2.15.7 - 2024-05-12
 
 Release notes:
 
 * This release fixes potential bugs.
+* The hash that Stack uses to distinguish one build plan from another has
+  changed for plans that set (as opposed to unset) manually Cabal flags for
+  immutable dependencies. This will cause Stack to rebuild dependencies for such
+  plans.
 
+**Changes since v2.15.5:**
+
+Major changes:
+
+* Stack 2.15.5 and earlier cannot build with Cabal (the library) version
+  `3.12.0.0`. Stack can now build with that Cabal version.
+
+Behavior changes:
+
+* Stack's `StackSetupShim` executable, when called with `repl` and
+  `stack-initial-build-steps`, no longer uses Cabal's `replHook` to apply
+  `initialBuildSteps` but takes a more direct approach.
+
+Bug fixes:
+
+* Fix a regression introduced in Stack 2.15.1 that caused a 'no operation'
+  `stack build` to be slower than previously.
+* The hashes that Stack uses to distinguish one build plan from another now
+  include the Cabal flags for immutable dependencies set manually. Previously,
+  in error, only such flags that were unset manually were included.
+
+## v2.15.5 - 2024-03-28
+
+Release notes:
+
+* This release fixes potential bugs.
+
 **Changes since v2.15.3:**
 
-Behaviour changes:
+Behavior changes:
 
 * Following the handover of the Stackage project to the Haskell Foundation, the
   default value of the `urls` key is
@@ -187,7 +218,8 @@
   precedence over the existing `casa-repo-prefix` key. The latter is deprecated.
   The new key also allows Stack's use of a Casa (content-addressable storage
   archive) server to be disabled and the maximum number of keys per request to
-  be configured. The defaults are unchanged.
+  be configured. The default Casa prefix references https://casa.stackage.org,
+  instead of https://casa.fpcomplete.com.
 * Add option `--progress-bar=<format>` to Stack's `build` command to configure
   the format of the progress bar, where `<format>` is one of `none`,
   `count-only` (only the package count), `capped` (capped to a length equal to
diff --git a/doc/GUIDE.md b/doc/GUIDE.md
--- a/doc/GUIDE.md
+++ b/doc/GUIDE.md
@@ -248,7 +248,7 @@
 
 ~~~yaml
 resolver:
-  url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/11.yaml
+  url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/21.yaml
 packages:
 - .
 ~~~
@@ -256,7 +256,7 @@
 The value of the [`resolver`](yaml_configuration.md#resolver) key tells Stack
 *how* to build your package: which GHC version to use, versions of package
 dependencies, and so on. Our value here says to use
-[LTS Haskell 22.11](https://www.stackage.org/lts-22.11), which implies GHC 9.6.4
+[LTS Haskell 22.21](https://www.stackage.org/lts-22.21), which implies GHC 9.6.5
 (which is why `stack build` installs that version of GHC if it is not already
 available to Stack). There are a number of values you can use for `resolver`,
 which we'll cover later.
@@ -980,7 +980,7 @@
 stack build :helloworld-test
 helloworld> configure (lib + test)
 Configuring helloworld-0.1.0.0...
-helloworld> build (lib + test) with ghc-9.6.4
+helloworld> build (lib + test) with ghc-9.6.5
 Preprocessing library for helloworld-0.1.0.0..
 Building library for helloworld-0.1.0.0..
 [1 of 2] Compiling Lib
@@ -1298,7 +1298,7 @@
 
 ~~~text
 Run from outside a project, using implicit global project config
-Using latest snapshot resolver: lts-22.7
+Using latest snapshot resolver: lts-22.21
 Writing global (non-project-specific) config file to: /home/michael/.stack/global/stack.yaml
 Note: You can change the snapshot via the resolver field there.
 I installed the stm package via --package stm
diff --git a/doc/README.md b/doc/README.md
--- a/doc/README.md
+++ b/doc/README.md
@@ -121,6 +121,10 @@
     use GHCup) is to download and install the
     [Windows installer](https://get.haskellstack.org/stable/windows-x86_64-installer.exe).
 
+    !!! info
+
+        By default, the Windows installer will set the Stack root to `C:\sr`.
+
     !!! warning
 
         The Windows installer for Stack 2.9.1, 2.9.3 and 2.11.1 (only) will
diff --git a/doc/Stack_and_VS_Code.md b/doc/Stack_and_VS_Code.md
--- a/doc/Stack_and_VS_Code.md
+++ b/doc/Stack_and_VS_Code.md
@@ -75,9 +75,9 @@
 
 For this workaround to work, each time that a snapshot is used that references a
 different version of GHC, then GHCup must be used to install it (if GHCup has
-not already installed that version). For example, to use `snapshot: lts-22.7`
-(GHC 9.6.4), the command `ghcup install ghc 9.6.4` must have been used to
-install GHC 9.6.4. That may be a minor inconvenience for some people, as one the
+not already installed that version). For example, to use `snapshot: lts-22.21`
+(GHC 9.6.5), the command `ghcup install ghc 9.6.5` must have been used to
+install GHC 9.6.5. That may be a minor inconvenience for some people, as one the
 primary benefits of Stack over other Haskell build tools has been that Stack
 automatically ensures that the necessary version of GHC is available.
 
diff --git a/doc/build_command.md b/doc/build_command.md
--- a/doc/build_command.md
+++ b/doc/build_command.md
@@ -236,22 +236,51 @@
 
 ### `--flag` option
 
+The option can be specified multiple times. It has two forms:
+
+* `--flag <package_name>:[-]<flag_name>`; and
+
+* `--flag *:[-]<flag_name>`.
+
 `stack build --flag <package_name>:[-]<flag_name>` sets (or unsets) the
-specified Cabal flag for the specified package.
+specified Cabal flag for the specified package. Stack will report an error if:
 
-This option can be specified multiple times to set (or unset) multiple Cabal
-flags.
+* a package of that name is not known to Stack; or
 
-The same Cabal flag name can be set (or unset) for multiple packages (at the
-command line only) with:
+* a flag of that name is not a flag of that package.
 
-~~~text
-stack build --flag *:[-]<flag_name>
-~~~
+This overrides:
 
-In order to set a Cabal flag for a GHC boot package, the package must be
-specified as an extra-dep.
+* any Cabal flag specifications for the package in the snapshot;
 
+* any Cabal flag specifications for the package in Stack's project-level
+  configuration file (`stack.yaml`); and
+
+* any use of `--flag *` (see below).
+
+`stack build --flag *:[-]<flag_name>` sets (or unsets) the specified Cabal flag
+for all packages (project packages and dependencies) (whether or not a flag of
+that name is a flag of the package).
+
+This overrides:
+
+* any Cabal flag specifications for packages in the snapshot; and
+
+* any Cabal flag specifications for packages in Stack's project-level
+  configuration file (`stack.yaml`).
+
+!!! note
+
+    For a package included directly in the snapshot, if the Cabal flag
+    specifications differ from the Cabal flag specifications (if any) in the
+    snapshot, then the package will automatically be promoted to be an
+    [extra-dep](#extra-deps).
+
+!!! note
+
+    In order to set a Cabal flag for a GHC boot package, the package must be
+    specified as an [extra-dep](yaml_configuration.md#extra-deps).
+
 ### `--[no-]force-dirty` flag
 
 Default: Disabled
@@ -581,6 +610,9 @@
 Set the flag to enable executable profiling for TARGETs and all its
 dependencies.
 
+The flag affects the location of the local project installation directory. See
+the [`stack path --local-install-root`](path_command.md) command.
+
 ### `--[no-]executable-stripping` flag
 
 Default: Enabled
@@ -588,6 +620,9 @@
 Unset the flag to disable executable stripping for TARGETs and all its
 dependencies.
 
+The flag may affect the location of the local project installation directory.
+See the [`stack path --local-install-root`](path_command.md) command.
+
 ### `--fast` flag
 
 GHC has many flags that specify individual optimisations of the compiler. GHC
@@ -636,6 +671,9 @@
 
 Set the flag to enable library profiling for TARGETs and all its dependencies.
 
+The flag affects the location of the local project installation directory. See
+the [`stack path --local-install-root`](path_command.md) command.
+
 ### `--[no-]library-stripping` flag
 
 Default: Enabled
@@ -643,6 +681,9 @@
 Unset the flag to disable library stripping for TARGETs and all its
 dependencies.
 
+The flag may affect the location of the local project installation directory.
+See the [`stack path --local-install-root`](path_command.md) command.
+
 ### `--pedantic` flag
 
 Pass the flag to build your project with the GHC options `-Wall` and `-Werror`.
@@ -654,13 +695,16 @@
 Pass the flag to enable profiling in libraries, executables, etc. for all
 expressions, and generate a profiling report in tests or benchmarks.
 
+The flag affects the location of the local project installation directory. See
+the [`stack path --local-install-root`](path_command.md) command.
+
 ### `--[no-]split-objs` flag
 
 :octicons-beaker-24: Experimental
 
 Default: Disabled
 
-Set the flag to enable the GHC option `--split-objs`. This will reduce output
+Set the flag to enable the GHC option `-split-objs`. This will reduce output
 size (at the cost of build time).
 
 !!! note
@@ -670,6 +714,11 @@
     compile all dependencies with split-objs, you will need to delete the
     snapshot (and all snapshots that could reference that snapshot).
 
+!!! note
+
+    GHC's `-split-objs` flag was deprecated in favour of `-split-sections` in
+    GHC 8.2.1 and was not supported by GHC on any platform from GHC 8.10.1.
+
 ### `--no-strip` flag
 
 Pass the flag to disable DWARF debugging symbol stripping in libraries,
@@ -677,10 +726,16 @@
 the use of standard debuggers/profiling tools/other utilities that use debugging
 symbols.
 
+The flag affects the location of the local project installation directory. See
+the [`stack path --local-install-root`](path_command.md) command.
+
 ### `--trace` flag
 
 Pass the flag to enable profiling in libraries, executables, etc. for all
 expressions, and generate a backtrace on exception.
+
+The flag affects the location of the local project installation directory. See
+the [`stack path --local-install-root`](path_command.md) command.
 
 ## Flags affecting other tools' behaviour
 
diff --git a/doc/config_command.md b/doc/config_command.md
--- a/doc/config_command.md
+++ b/doc/config_command.md
@@ -34,6 +34,12 @@
 * `--[no-]keep-ghc-rts` (disabled by default) keep/discard any `GHCRTS`
   environment variable
 
+The command also accepts flags and options of the
+[`stack build`](build_command.md#flags-affecting-ghcs-behaviour) command that
+affect the location of the local project installation directory, such as
+`--profile` and `--no-strip`. For further information, see the documentation of
+the [project Stack work directory](stack_work.md#project-stack-work-directory).
+
 ## The `stack config set` commands
 
 ~~~text
@@ -51,6 +57,11 @@
 
 The `stack config set` commands allow the values of keys in YAML configuration
 files to be set. See `stack config set` for the available keys.
+
+!!! note
+
+    The `config set` commands support an existing key only in the form
+    `key: value` on a single line.
 
 ## The `stack config set install-ghc` command
 
diff --git a/doc/custom_snapshot.md b/doc/custom_snapshot.md
--- a/doc/custom_snapshot.md
+++ b/doc/custom_snapshot.md
@@ -18,8 +18,8 @@
     for snapshot specification.
 
 ~~~yaml
-snapshot: lts-22.7 # Inherits GHC version and package set
-compiler: ghc-9.6.3 # Overwrites GHC version in the snapshot, optional
+snapshot: lts-22.21 # Inherits GHC version and package set
+compiler: ghc-9.6.4 # Overwrites GHC version in the snapshot, optional
 
 # Additional packages, follows extra-deps syntax
 packages:
@@ -62,35 +62,35 @@
 
 ### Overriding the compiler
 
-The following snapshot specification will be identical to `lts-22.7`, but
-instead use `ghc-9.6.3` instead of `ghc-9.6.4`:
+The following snapshot specification will be identical to `lts-22.21`, but
+instead use `ghc-9.6.4` instead of `ghc-9.6.5`:
 
 ~~~yaml
-snapshot: lts-22.7
-compiler: ghc-9.6.3
+snapshot: lts-22.21
+compiler: ghc-9.6.4
 ~~~
 
 ### Dropping packages
 
-The following snapshot specification will be identical to `lts-22.7`, but
+The following snapshot specification will be identical to `lts-22.21`, but
 without the `text` package in our snapshot. Removing this package will cause all
 the packages that depend on `text` to be unbuildable, but they will still be
 present in the snapshot.
 
 ~~~yaml
-snapshot: lts-22.7
+snapshot: lts-22.21
 drop-packages:
 - text
 ~~~
 
 ### Hiding packages
 
-The following snapshot specification will be identical to `lts-22.7`, but the
+The following snapshot specification will be identical to `lts-22.21`, but the
 `text` package will be hidden when registering. This will affect, for example,
 the import parser in the script command.
 
 ~~~yaml
-snapshot: lts-22.7
+snapshot: lts-22.21
 hidden:
 - text
 ~~~
@@ -100,11 +100,11 @@
 In order to specify GHC options for a package, you use the same syntax as the
 [ghc-options](yaml_configuration.md#ghc-options) key for build configuration.
 
-The following snapshot specification will be identical to `lts-22.7`, but
+The following snapshot specification will be identical to `lts-22.21`, but
 provides `-O1` as a ghc-option for `text`:
 
 ~~~yaml
-snapshot: lts-22.7
+snapshot: lts-22.21
 packages:
 - text-2.0.2
 ghc-options:
@@ -123,11 +123,11 @@
 
 In order to specify Cabal flags for a package, you use the same syntax as the
 [flags](yaml_configuration.md#flags) key for build configuration. The
-following snapshot specification will be identical to `lts-22.7`, but
+following snapshot specification will be identical to `lts-22.21`, but
 it enables the `developer` Cabal flag:
 
 ~~~yaml
-snapshot: lts-22.7
+snapshot: lts-22.21
 packages:
 - text-2.0.2
 flags:
diff --git a/doc/developing_on_windows.md b/doc/developing_on_windows.md
--- a/doc/developing_on_windows.md
+++ b/doc/developing_on_windows.md
@@ -64,8 +64,18 @@
 common Haskell packages on Windows. Feel free to submit additional entries via a
 pull request.
 
-* For [text-icu](https://github.com/bos/text-icu) install
-  `mingw64/mingw-w64-x86_64-icu`
+*   For [text-icu](https://hackage.haskell.org/package/text-icu) install
+    `mingw64/mingw-w64-x86_64-icu`.
+
+*   For [zlib >= 0.7](https://hackage.haskell.org/package/zlib) the default
+    Cabal flag `pkg-config` is `true` and requires executable `pkg-config` on
+    the PATH. MSYS2 [defaults](https://www.msys2.org/docs/pkgconfig/) to
+    [`pkgconf`](https://packages.msys2.org/package/pkgconf?repo=msys&variant=x86_64)
+    as its `pkg-config` implementation. Installation:
+
+        stack exec -- pacman -S pkgconf
+
+    Alternatively, build with `--flag zlib:-pkg-config`.
 
 ## CMake ##
 
diff --git a/doc/docker_integration.md b/doc/docker_integration.md
--- a/doc/docker_integration.md
+++ b/doc/docker_integration.md
@@ -262,7 +262,7 @@
 
 FP Complete provides the following public image repositories on Docker Hub:
 
-- [fpco/stack-build](https://registry.hub.docker.com/u/fpco/stack-build/) (the
+- [fpco/stack-build](https://registry.hub.docker.com/r/fpco/stack-build/) (the
   default) - GHC (patched), tools (Stack, Cabal (the tool), happy, alex, etc.),
   and system developer libraries required to build all Stackage packages.
 
diff --git a/doc/exec_command.md b/doc/exec_command.md
--- a/doc/exec_command.md
+++ b/doc/exec_command.md
@@ -64,3 +64,9 @@
 
     The content of single quotes is taken literally. Within single quotes, `''`
     escapes a single quote.
+
+The command also accepts flags and options of the
+[`stack build`](build_command.md#flags-affecting-ghcs-behaviour) command that
+affect the location of the local project installation directory, such as
+`--profile` and `--no-strip`. For further information, see the documentation of
+the [project Stack work directory](stack_work.md#project-stack-work-directory).
diff --git a/doc/faq.md b/doc/faq.md
--- a/doc/faq.md
+++ b/doc/faq.md
@@ -9,7 +9,7 @@
 ## What version of GHC is used when I run something like `stack ghci`?
 
 The version of GHC, as well as which packages can be installed, are specified by
-the _snapshot_. This may be something like `lts-22.7`, which is from
+the _snapshot_. This may be something like `lts-22.21`, which is from
 [Stackage](https://www.stackage.org/). The [user's guide](GUIDE.md) discusses
 the snapshot in more detail.
 
@@ -76,11 +76,11 @@
 value in your `stack.yaml` file, e.g.:
 
 ~~~yaml
-snapshot: lts-22.7
+snapshot: lts-22.21
 packages:
 - .
 extra-deps:
-- text-2.0.2@rev:1
+- text-2.1.1@rev:0
 ~~~
 
 ## I need to use a package (or version of a package) that is not available on Hackage, what should I do?
@@ -91,7 +91,7 @@
 directory where your `stack.yaml` file lives, e.g.
 
 ~~~yaml
-snapshot: lts-22.7
+snapshot: lts-22.21
 packages:
 - .
 extra-deps:
@@ -337,6 +337,35 @@
 Yes, Stack supports using Docker with images that contain preinstalled Stackage
 packages and the tools. See [Docker integration](docker_integration.md) for
 details.
+
+## How do I build a statically-linked executable on Linux?
+
+The way that Stack itself builds statically-linked Stack executables for Linux
+is as follows:
+
+* In the Cabal file, the following
+  [`ld-options`](https://cabal.readthedocs.io/en/stable/cabal-package.html#pkg-field-ld-options)
+  are set: `-static` and `-pthread`.
+
+* The Stack command is run in a Docker container based on Alpine Linux. The
+  relevant Docker image repository is set out in Stack's `stack.yaml` file. See
+  also Olivier Benz's [GHC musl project](https://gitlab.com/benz0li/ghc-musl).
+
+* Stack's configuration includes:
+
+    ~~~yaml
+    extra-include-dirs:
+    - /usr/include
+    extra-lib-dirs:
+    - /lib
+    - /usr/lib
+    ~~~
+
+* The build command is `stack build --docker --system-ghc --no-install-ghc` (on
+  x86_64) or
+  `stack build --docker --docker-stack-exe=image --system-ghc --no-install-ghc`
+  (on AArch64; the host Stack and the image Stack must have the same version
+  number).
 
 ## How do I use this with Travis CI?
 
diff --git a/doc/ghci.md b/doc/ghci.md
--- a/doc/ghci.md
+++ b/doc/ghci.md
@@ -15,105 +15,124 @@
 The `stack ghci` or `stack repl` commands, which are equivalent, allow you to
 load components and files of your project into GHCi.
 
-The command uses the same TARGET syntax as `stack build`. It can also take flags
-like `--test` and `--bench` and options like `--flag`. Similarly to
-`stack build`, the default is to load up GHCi with all libraries and executables
-in the project.
+The command accepts the same TARGET syntax as
+[`stack build`](build_command.md#target-syntax). By default:
 
-In order to load multiple components, `stack ghci` combines all of the GHC
-options together. This doesn't work in the general case, but when the packages
-being loaded share similar conventions, it should work out. A common source of
-issues is when one component defines default extensions which aren't assumed by
-another component. For example, specifying `NoImplicitPrelude` in one component
-but not another is quite likely to cause failures. GHCi will be run with
-`-XNoImplicitPrelude`, but it is likely that modules in the other component
-assume that the `Prelude` is implicitly imported.
+* Stack loads up GHCi with all the library and executable components of all the
+  packages in the project. Pass the flag `--test` to include test suite
+  components (unlike `stack build`, test suites will not be run). Pass the flag
+  `--bench` to include benchmark components (unlike `stack build`, benchmarks
+  will not be run).
 
-`stack ghci` configures GHCi by using a GHCi script file. Such files are located
-in subdirectories of `<XDG_CACHE_HOME>/stack/ghci-script`, where
-`<XDG_CACHE_HOME>` refers to the
-[XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
-for user-specific non-essential (cached) data. On Unix-like operating systems,
-the default for `<XDG_CACHE_HOME>` is `$HOME/.cache`. On Windows, the default
-is `%LOCALAPPDATA%`.
+It is also possible to specify a module source code file. For example:
 
-## Selecting Main module
+~~~text
+stack ghci src/MyFile.hs
+~~~
 
-When loading multiple packages, there may be multiple definitions for the `Main`
-module. You can specify which `Main` module to load with the
-`--main-is <target>` option. If no selection is made and there are multiple
-`Main` modules, you will be asked to select from a list of options.
+Stack will identify which component the file is associated with, and use the
+options from that component.
 
-## Speeding up initial load
+Pass the `--package` option to load GHCi with an additional package that is not
+a direct dependency of your components. This option can be specified multiple
+times.
 
-There are two ways to speed up the initial startup of GHCi:
+Pass the option `--flag <package_name>:<flag_name>` or
+`--flag <package_name:-<flag_name>` to set or unset a Cabal flag. This option
+can be specified multiple times. The same Cabal flag name can be set (or unset)
+for multiple packages with:
 
-1.  Pass the `--no-build` flag, to skip an initial build step. This works only
-    if the dependencies have already been built.
+~~~text
+--flag *:[-]<flag_name>
+~~~
 
-2.  Pass the `--no-load` flag, to skip loading all defined modules into GHCi.
-    You can then directly use `:load MyModule` in GHCi to load a specific module
-    in your project.
+!!! note
 
-## Loading just the main module
+    In order to set a Cabal flag for a GHC boot package, the package must either
+    be an extra-dep or the package version must be specified with the
+    `--package` option.
 
-By default, `stack ghci` loads and imports all of the modules in the package.
-This allows you to easily use anything exported by your package. This is usually
-quite convenient, but in some cases it makes sense to only load one module, or
-no modules at all. The `--only-main` flag allows this. It specifies that only
-the main module will be loaded, if any. This is particularly useful in the
-following circumstances:
+By default:
 
-1. You're loading the project in order to run it in GHCi (e.g. via `main`), and
-   you intend to reload while developing. Without the `--only-main` flag, you
-   will need to quit and restart GHCi whenever a module gets deleted. With the
-   flag, reloading should work fine in this case.
+*   Stack uses the GHC specified in Stack's configuration. Pass the `--with-ghc`
+    option with a file path to the executable to specify a different GHC
+    executable;
 
-2. If many of your modules have exports named the same thing, then you'll need
-   to refer to them using qualified names. To avoid this, it may be easier to
-   use the `--only-main` flag to start with a blank slate and just import the
-   modules you are interested in.
+*   Stack performs an inital build step. Pass the `--no-build` flag to skip the
+    step. Pass the `--ghc-options` option to pass flags or options to GHC. Pass
+    the `--profile`, `--no-strip`, `--trace` flags for the same behaviour as in
+    the case of the `stack build` command.
 
-## Loading a filepath directly
+    !!! info
 
-Instead of the `TARGET` syntax, it is also possible to command directly, for
-example:
+        Not performing the initial build step speeds up the startup of GHCi. It
+        only works if the dependencies of the loaded packages have already been
+        built.
 
-~~~text
-stack ghci src/MyFile.hs
-~~~
+*   Stack runs GHCi via `ghc --interactive`. Pass the `--ghc-options` option to
+    pass flags or options to GHC (during the initial build step) and to GHCi.
+    Pass the `--pedantic` flag to pass the GHC options `-Wall` and `-Werror` to
+    GHCi (only). Pass the `--ghci-options` option to pass flags or options to
+    GHCi (only).
 
-This will figure out which component the file is associated with, and use the
-options from that component.
+*   Stack configures GHCi to hide unnecessary packages, unless no packages are
+    targetted and no additional packages are specified. Pass the
+    `--package-hiding` flag to hide unnecessary packages or
+    `--no-package-hiding` flag not to hide unnecessary packages.
 
-## Specifying extra packages to build or depend on
+*   Stack loads and imports all of the modules for each target. Pass the
+    `--no-load` flag to skip the loading of modules. Pass the `--only-main` flag
+    to skip the loading of modules other than the main module. Pass the
+    `--load-local-deps` flag to include all local dependencies of targets.
 
-Sometimes you want to load GHCi with an additional package, that isn't a direct
-dependency of your components. This can be achieved by using the `--package`
-option. For example, if I want to experiment with the `lens` library, I can
-command:
+    !!! info
 
-~~~text
-stack ghci --package lens
-~~~
+        Not loading modules speeds up the startup of GHCi. Once in GHCi, you can
+        use `:load myModule` to load a specific module in your project.
 
-## Specifying Cabal flags
+    !!! info
 
-`--flag <package_name>:[-]<flag_name>` sets (or unsets) the specified Cabal flag
-for the specified package.
+        The `--only-main` flag can be useful if:
 
-This option can be specified multiple times to set (or unset) multiple Cabal
-flags.
+        1.  You're loading the project in order to run it in GHCi (e.g. via
+            `main`), and you intend to reload while developing. Without flag,
+            you will need to quit and restart GHCi whenever a module gets
+            deleted. With the flag, reloading should work fine in this case.
 
-The same Cabal flag name can be set (or unset) for multiple packages with:
+        2.  If many of your modules have exports named the same thing, then
+            you'll need to refer to them using qualified names. To avoid this,
+            use the `--only-main` flag to start with a blank slate and just
+            import the modules you are interested in.
 
-~~~text
---flag *:[-]<flag_name>
-~~~
+*   If there are multiple definitions for the `Main` module, Stack will ask you
+    to select one from a list of options. Pass the `--main-is <target>` option
+    to specific which `Main` module to load.
 
-In order to set a Cabal flag for a GHC boot package, the package must either be
-an extra-dep or the package version must be specified with the `--package`
-option.
+Stack combines all of the GHC options of components.
+
+!!! note
+
+    Combining GHC options should work out when packages share similar
+    conventions. However, conflicts may arise, such as when one component
+    defines default extensions which aren't assumed by another. For example,
+    specifying `NoImplicitPrelude` in one component but not another is likely to
+    cause failures. GHCi will be run with `-XNoImplicitPrelude`, but it is
+    likely that modules in the other component assume that the `Prelude` is
+    implicitly imported.
+
+`stack ghci` configures GHCi by using a GHCi script file. Such files are located
+in subdirectories of `<XDG_CACHE_HOME>/stack/ghci-script`, where
+`<XDG_CACHE_HOME>` refers to the
+[XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
+for user-specific non-essential (cached) data.
+
+=== "Unix-like"
+
+    The default for `<XDG_CACHE_HOME>` is `$HOME/.cache`.
+
+=== "Windows"
+
+     On Windows, the default for `<XDG_CACHE_HOME>` is `%LOCALAPPDATA%`.
 
 ## Running plain GHCi
 
diff --git a/doc/init_command.md b/doc/init_command.md
--- a/doc/init_command.md
+++ b/doc/init_command.md
@@ -34,3 +34,9 @@
 order of preference, using the first that is compatable: the most recent LTS
 Haskell, the most recent Stackage Nightly, and other LTS Haskell (most recent
 first).
+
+!!! note
+
+    If Cabal (the tool) has been used in the directory, consider commanding
+    `cabal clean` before applying `stack init`, in case Cabal has created any
+    unintended Cabal files.
diff --git a/doc/install_and_upgrade.md b/doc/install_and_upgrade.md
--- a/doc/install_and_upgrade.md
+++ b/doc/install_and_upgrade.md
@@ -410,11 +410,14 @@
         |GHC version|LLVM versions|
         |-----------|-------------|
         |9.8.2      |11 to 15     |
-        |9.6.4      |11 to 15     |
+        |9.6.5      |11 to 15     |
         |9.4.8      |10 to 14     |
         |9.2.8      |9 to 12      |
         |9.0.2      |9, 10 or 12  |
         |8.10.7     |9 to 12      |
+        |8.8.4      |7            |
+        |8.6.5      |6            |
+        |8.4.4      |5            |
 
     ### Using Homebrew
 
@@ -486,6 +489,11 @@
     On 64-bit Windows, the easiest way to install Stack directly (rather than
     use GHCup) is to download and use the
     [Windows installer](https://get.haskellstack.org/stable/windows-x86_64-installer.exe).
+
+    !!! info "Stack root"
+
+        By default, the Windows installer will set the Stack root by setting the
+        `STACK_ROOT` environment variable to `C:\sr`.
 
     !!! warning "Long user PATH environment variable"
 
diff --git a/doc/list_command.md b/doc/list_command.md
--- a/doc/list_command.md
+++ b/doc/list_command.md
@@ -44,17 +44,20 @@
          pantry, pretty, pasty, xattr, alloy, para, pappy, alure, polar and
          factory.
 
-stack --snapshot lts-22.7 list base unix Win32 acme-missiles pantry
+stack --snapshot lts-22.21 list base unix Win32 acme-missiles pantry
 Error: [S-4926]
        * Package does not appear in snapshot: base.
        * Package does not appear in snapshot: unix.
        * Package does not appear in snapshot: Win32.
        * Package does not appear in snapshot: acme-missiles.
 
-stack --snapshot lts-22.7 list pantry
-pantry-0.9.3.1
+stack --snapshot lts-22.21 list base unix Win32 pantry
+base-4.18.2.1
+unix-2.8.4.0
+Win32-2.13.3.0
+pantry-0.9.3.2
 
-stack --snapshot lts-22.7 list
+stack --snapshot lts-22.21 list
 AC-Angle-1.0
 ALUT-2.4.0.3
 ...
diff --git a/doc/nix_integration.md b/doc/nix_integration.md
--- a/doc/nix_integration.md
+++ b/doc/nix_integration.md
@@ -431,7 +431,7 @@
 through Nix can be modified to find the external C libraries provided through
 Nix.
 
-[nix-language]: https://nixos.wiki/wiki/Overview_of_the_Nix_Language
+[nix-language]: https://wiki.nixos.org/wiki/Overview_of_the_Nix_Language
 [nix-manual-exprs]: http://nixos.org/manual/nix/stable/expressions/writing-nix-expressions.html
 [nix-search-packages]: https://search.nixos.org/packages
 [nixpkgs-manual-haskell]: https://haskell4nix.readthedocs.io/nixpkgs-users-guide.html?highlight=buildStackProject#how-to-build-a-haskell-project-using-stack
diff --git a/doc/path_command.md b/doc/path_command.md
--- a/doc/path_command.md
+++ b/doc/path_command.md
@@ -41,3 +41,9 @@
 |--snapshot-install-root|The root directory for snapshot installation.         |
 |--snapshot-pkg-db      |The snapshot package database.                        |
 |--stack-root           |The Stack root.                                       |
+
+The command also accepts flags and options of the
+[`stack build`](build_command.md#flags-affecting-ghcs-behaviour) command that
+affect the location of the local project installation directory, such as
+`--profile` and `--no-strip`. For further information, see the documentation of
+the [project Stack work directory](stack_work.md#project-stack-work-directory).
diff --git a/doc/script_command.md b/doc/script_command.md
--- a/doc/script_command.md
+++ b/doc/script_command.md
@@ -18,7 +18,7 @@
 the command line (with the `--snapshot` option). For example:
 
 ~~~text
-stack script --snapshot lts-22.7 MyScript.hs
+stack script --snapshot lts-22.21 MyScript.hs
 ~~~
 
 The `stack script` command behaves as if the `--install-ghc` flag had been
@@ -100,7 +100,7 @@
 can be compiled and run, with arguments, with:
 
 ~~~text
-stack --snapshot lts-22.7 script --package acme-missiles --compile MyScript.hs -- "Don't panic!" "Duck and cover!"
+stack --snapshot lts-22.21 script --package acme-missiles --compile MyScript.hs -- "Don't panic!" "Duck and cover!"
 ~~~
 
 All the compilation outputs (like `Main.hi`, `Main.o`, and the executable
diff --git a/doc/scripts.md b/doc/scripts.md
--- a/doc/scripts.md
+++ b/doc/scripts.md
@@ -19,7 +19,7 @@
 
 ~~~haskell
 #!/usr/bin/env stack
--- stack script --snapshot lts-22.7 --package turtle
+-- stack script --snapshot lts-22.21 --package turtle
 {-# LANGUAGE OverloadedStrings #-}
 import Turtle (echo)
 main = echo "Hello World!"
@@ -78,10 +78,10 @@
 
 The second line of the source code is the Stack interpreter options comment. In
 this example, it specifies the `stack script` command with the options of a
-LTS Haskell 22.7 snapshot (`--snapshot lts-22.7`) and ensuring the
+LTS Haskell 22.21 snapshot (`--snapshot lts-22.21`) and ensuring the
 [`turtle` package](https://hackage.haskell.org/package/turtle) is available
 (`--package turtle`). The version of the package will be that in the specified
-snapshot (`lts-22.7` provides `turtle-1.6.2`).
+snapshot (`lts-22.21` provides `turtle-1.6.2`).
 
 ## Arguments and interpreter options and arguments
 
@@ -116,7 +116,7 @@
 ~~~haskell
 #!/usr/bin/env stack
 {- stack script
-   --snapshot lts-22.7
+   --snapshot lts-22.21
    --
    +RTS -s -RTS
 -}
@@ -132,7 +132,7 @@
 is equivalent to the following command at the command line:
 
 ~~~text
-stack script --snapshot lts-22.7 -- MyScript.hs arg1 arg2 +RTS -s -RTS
+stack script --snapshot lts-22.21 -- MyScript.hs arg1 arg2 +RTS -s -RTS
 ~~~
 
 where `+RTS -s -RTS` are some of GHC's
@@ -161,7 +161,7 @@
 ~~~haskell
 #!/usr/bin/env stack
 {- stack script
-   --snapshot lts-22.7
+   --snapshot lts-22.21
    --package turtle
    --package "stm async"
    --package http-client,http-conduit
@@ -191,7 +191,7 @@
 
 ~~~haskell
 {- stack script
-   --snapshot lts-22.7
+   --snapshot lts-22.21
    --package acme-missiles
 -}
 import Acme.Missiles (launchMissiles)
@@ -202,7 +202,7 @@
 
 The command `stack --script-no-run-compile Script.hs` then behaves as if the
 command
-`stack script --snapshot lts-22.7 --package acme-missiles --no-run --compile -- Script.hs`
+`stack script --snapshot lts-22.21 --package acme-missiles --no-run --compile -- Script.hs`
 had been given. `Script.hs` is compiled (without optimisation) and the resulting
 executable is not run: no missiles are launched in the process!
 
@@ -239,7 +239,7 @@
 {- stack
   runghc
   --install-ghc
-  --snapshot lts-22.7
+  --snapshot lts-22.21
   --package base
   --package turtle
   --
@@ -262,7 +262,7 @@
 {- stack
    exec ghci
    --install-ghc
-   --snapshot lts-22.7
+   --snapshot lts-22.21
    --package turtle
 -}
 ~~~
diff --git a/doc/stack_root.md b/doc/stack_root.md
--- a/doc/stack_root.md
+++ b/doc/stack_root.md
@@ -221,6 +221,22 @@
 If the contents of the directory are deleted, and Stack needs the executable,
 Stack will recreate them.
 
+The hash in the names of the source files is a hash of arguments passed to GHC
+when building the executable and the contents of the two source files.
+
+The content of the `setup-<hash>.hs` file is the familiar:
+
+~~~haskell
+import Distribution.Simple
+main = defaultMain
+~~~
+
+The content of the `setup-shim-<hash>.hs` file uses `main` except when the
+executable is called with arguments `repl` and `stack-initial-build-steps`. Then
+Stack uses Cabal (the library) to create the autogenerated files for every
+configured component. Stack's `stack ghci` or `stack repl` commands call the
+executable with those arguments.
+
 ### `snapshots` directory
 
 This contains a directory for each snapshot that Stack creates when building
diff --git a/doc/stack_work.md b/doc/stack_work.md
new file mode 100644
--- /dev/null
+++ b/doc/stack_work.md
@@ -0,0 +1,144 @@
+<div class="hidden-warning"><a href="https://docs.haskellstack.org/"><img src="https://cdn.jsdelivr.net/gh/commercialhaskell/stack/doc/img/hidden-warning.svg"></a></div>
+
+# Stack work directories
+
+Stack work directories are directories within a local project or package
+directory in which Stack stores files created during the build process. Stack
+can be used without an understanding of the content of those directories. In
+particular, the [`stack exec`](exec_command.md) command sets up an environment
+where relevant subdirectories of the project Stack work directory are on the
+PATH.
+
+## Naming
+
+By default, Stack work directories are named `.stack-work`. The name can be
+overidden by:
+
+* the use of the
+  [`STACK_WORK` environment variable](environment_variables.md#stack_work);
+* the [`work-dir`](yaml_configuration.md#work-dir) non-project specific
+  configuration option; or
+* the [`--work-dir`](global_flags.md#-work-dir-option) command line option.
+
+Given the location of Stack work directories, the name of the work directories
+must be a relative path to a directory.
+
+## Location
+
+If the work directory does not already exist, it will be created by the
+[`stack build`](build_command.md) command as a subdirectory of each project
+package directory and, if different, the project directory.
+
+## Project package Stack work directory
+
+The Stack work directory for a project package will contain a `dist` directory.
+This directory will contain a path to a directory containing:
+
+* a `build` directory;
+* a `package.conf.inplace` directory;
+* a `stack-build-caches` directory;
+* a `build-lock` file;
+* a `setup-config` file;
+* a `stack-cabal-mod` file. This file is used by Stack only for its modification
+  time;
+* a `stack-project-root` file. This file contains an absolute path to the
+  project root directory; and
+* a `stack-setup-config-mod` file. This file is used by Stack only for its
+  modification time.
+
+The directory, relative to the project package directory or the project
+directory, is the one reported by [`stack path --dist-dir`](path_command.md).
+
+=== "Unix-like"
+
+    On Unix-like operating systems, the path to the directory is a directory
+    named after the platform (including Stack's classification of variants of
+    Linux distributions) followed by a directory named after the GHC version.
+
+=== "Windows"
+
+    On Windows, the path to the directory is an eight-character hash of the
+    path that applies on Unix-like operating systems.
+
+## Project Stack work directory
+
+The Stack work directory for a project will contain a `install` directory.
+This directory will contain a path to a directory containing:
+
+* a `bin` directory, containing built executable files;
+* a `doc` directory, containing a directory for each project package. This is
+  the directory reported by [`stack path --local-doc-root`](path_command.md);
+* if the [`stack hpc`](hpc_command.md) command is used, a `hpc` directory. This
+  is the directory reported by [`stack path --local-hpc-root`](path_command.md);
+* a `lib` directory, containing a directory named after the platform and the
+  GHC version and, within that, a directory for each project package;
+* a `pkgdb` directory. This is the directory reported by
+  [`stack path --local-pkg-db`](path_command.md);
+* a `stack.sqlite3` file; and
+* a `stack.sqlite3.pantry-write-lock` file.
+
+The directory is the one reported by
+[`stack path --local-install-root`](path_command.md).
+
+=== "Unix-like"
+
+    On Unix-like operating systems, the path to the directory is a directory
+    named after the platform (including Stack's classification of variants of
+    Linux distributions) followed by a directory named after a SHA 256 hash
+    (see further below) followed by a directory named after the version number
+    of GHC.
+
+    The SHA 256 hash is a hash of the following information:
+
+    * the path to the specified compiler;
+    * the information about the compiler provided by `ghc --info`;
+    * the options that Stack passes to GHC for package that is not a project
+      package; and
+    * information about the immutable dependencies: their location, whether or
+      not Haddock documentation is to be built, their flags, their GHC options,
+      and their Cabal configuration options.
+
+    The options that Stack passes to GHC for a package that is not a project
+    package depend on:
+
+    * the specification of
+      [profiling](https://docs.haskellstack.org/en/stable/build_command/#flags-affecting-ghcs-behaviour);
+    * the specification of
+      [stripping](https://docs.haskellstack.org/en/stable/build_command/#flags-affecting-ghcs-behaviour); and
+    * if
+      [`apply-ghc-options: everything`](yaml_configuration.md#apply-ghc-options)
+      is specified, any GHC command line options specified on the command line.
+
+    !!! note
+
+        As a consequence, the path reported by the following commands will
+        differ (and similarly for the paths established by the
+        [`stack exec`](exec_command.md) command):
+
+        ~~~text
+        stack path --local-install-root
+        stack --profile path --local-install-root
+        stack --no-strip path --local-install-root
+        stack --profile --no-strip path --local-install-root
+        ~~~
+
+=== "Windows"
+
+    On Windows, the path to the directory is an eight-character hash of the
+    path that applies on Unix-like operating systems.
+
+Following a `stack ghci` or `stack repl` command, the Stack work directory for
+a project will contain a `ghci` directory. This directory will contain paths to
+`cabal_macos.h` files that are generated automatically by Cabal.
+
+!!! note
+
+    Haskell Language Server makes use of the `stack ghci` command to obtain
+    information.
+
+If the [`stack hoogle`](hoogle_command.md) command is used, the Stack work
+directory for a project will contain a `hoogle` directory. This directory will
+contain a directory being the one reported by
+[`stack path --local-hoogle-root`](path_command.md). The naming of the path to
+the directory is same as for the path to the directory in the `install`
+directory.
diff --git a/doc/stack_yaml_vs_cabal_package_file.md b/doc/stack_yaml_vs_cabal_package_file.md
--- a/doc/stack_yaml_vs_cabal_package_file.md
+++ b/doc/stack_yaml_vs_cabal_package_file.md
@@ -64,9 +64,9 @@
 
 The most common means by which this set of packages is defined is via a
 snapshot provided by Stackage. For example, if you go to the page
-<https://www.stackage.org/lts-22.7>, you will see a list of 3,341 packages at
-specific version numbers. When you then specify `snapshot: lts-22.7` or,
-alternatively, `resolver: lts-22.7`, you're telling Stack to use those package
+<https://www.stackage.org/lts-22.21>, you will see a list of 3,342 packages at
+specific version numbers. When you then specify `snapshot: lts-22.21` or,
+alternatively, `resolver: lts-22.21`, you're telling Stack to use those package
 versions in resolving dependencies down to specific versions of packages.
 
 Sometimes a snapshot doesn't have all of the packages that you want. Or you want
diff --git a/doc/yaml_configuration.md b/doc/yaml_configuration.md
--- a/doc/yaml_configuration.md
+++ b/doc/yaml_configuration.md
@@ -115,10 +115,10 @@
 resolver since a snapshot states how dependencies are resolved. There are
 currently four snapshot types:
 
-* LTS Haskell snapshots, e.g. `snapshot: lts-22.7`
-* Stackage Nightly snapshots, e.g. `snapshot: nightly-2023-12-16`
+* LTS Haskell snapshots, e.g. `snapshot: lts-22.21`
+* Stackage Nightly snapshots, e.g. `snapshot: nightly-2024-05-06`
 * No snapshot, just use packages shipped with the compiler. For GHC this looks
-  like `snapshot: ghc-9.6.4`
+  like `snapshot: ghc-9.6.5`
 * Custom snapshot, via a URL or relative file path. For further information, see
   the [snapshot and package location](pantry.md) documentation.
 
@@ -261,6 +261,37 @@
 the same name. An extra-dep can be shadowed by a [project package](#packages) of
 the same name.
 
+!!! info
+
+    Some Haskell packages published on Hackage, for example `base` and `ghc`,
+    are referred to as 'wired-in' to one or more versions of GHC or as 'magic'.
+    They can be distinguished from normal packages by the contents of their
+    Cabal files: GHC's `-this-unit-id` option is set as the name of the package
+    without a version. For example, the `base.cabal` for `base-4.19.1.0`
+    includes:
+
+    ~~~yaml
+    -- We need to set the unit id to base (without a version number)
+    -- as it's magic.
+    ghc-options: -this-unit-id base
+    ~~~
+
+    The GHC boot packages that are 'wired-in' cannot be shaddowed with different
+    versions of the same package. Given their dependencies, the use of these
+    boot packages in a build plan may limit what can be specified as an
+    extra-dep.
+
+    For example, GHC boot package `ghc-9.8.2` has a dependency on `process`. Its
+    `*.conf` file identifies the dependency as `process-1.6.18.0-4fb7`. If
+    package `ghc-9.8.2` is part of a build plan and a different version of
+    `process` is specified as an extra-dep, during a build, Stack will identify
+    that the build plan refers to two versions of `process` and warn that the
+    build is likely to fail.
+
+    Stack treats the following as the names of 'wired-in' packages: `base`,
+    `dph-par`, `dph-seq`, `ghc-bignum`, `ghc-prim`, `ghc`, `integer-gmp`,
+    `integer-simple`, `interactive`, `rts` and `template-haskell`.
+
 ### flags
 
 Default: `{}`
@@ -276,13 +307,21 @@
     flag-name: true
 ~~~
 
-If a specified Cabal flag for a package included directly in a snapshot is
-different to the Cabal flag specified for that package in the snapshot, then the
-package will automatically be promoted to be an [extra-dep](#extra-deps).
+This overrides all Cabal flag specifications (if any) for the specified packages
+in the snapshot.
 
-In order to set a Cabal flag for a GHC boot package, the package must be
-specified as an [extra-dep](#extra-deps).
+!!! note
 
+    For a package included directly in the snapshot, if the Cabal flag
+    specifications differ from the Cabal flag specifications (if any) in the
+    snapshot, then the package will automatically be promoted to be an
+    [extra-dep](#extra-deps).
+
+!!! note
+
+    In order to set a Cabal flag for a GHC boot package, the package must be
+    specified as an [extra-dep](#extra-deps).
+
 ### drop-packages
 
 [:octicons-tag-24: 2.1.1](https://github.com/commercialhaskell/stack/releases/tag/v2.1.1)
@@ -639,7 +678,7 @@
 ~~~yaml
 casa:
   enable: true # Use a Casa server?
-  repo-prefix: https://casa.fpcomplete.com # Unless casa-repo-prefix is set.
+  repo-prefix: https://casa.stackage.org # Unless casa-repo-prefix is set.
   max-keys-per-request: 1280 # Maximum number of keys per request.
 ~~~
 
@@ -659,7 +698,7 @@
 
 Deprecated in favour of [`casa`](#casa), which takes precedence if present.
 
-Default: `https://casa.fpcomplete.com`
+Default: `https://casa.stackage.org`
 
 This option specifies the prefix for the URL used to pull information from the
 Casa server.
@@ -684,12 +723,12 @@
 
 Overrides the compiler version in the snapshot. Note that the `compiler-check`
 flag also applies to the version numbers. This uses the same syntax as compiler
-snapshots like `ghc-9.6.3`. This can be used to override the compiler for a
+snapshots like `ghc-9.6.5`. This can be used to override the compiler for a
 Stackage snapshot, like this:
 
 ~~~yaml
-snapshot: lts-22.7
-compiler: ghc-9.6.3
+snapshot: lts-22.21
+compiler: ghc-9.6.4
 compiler-check: match-exact
 ~~~
 
diff --git a/src/Stack/Build/ConstructPlan.hs b/src/Stack/Build/ConstructPlan.hs
--- a/src/Stack/Build/ConstructPlan.hs
+++ b/src/Stack/Build/ConstructPlan.hs
@@ -835,7 +835,6 @@
            (Set PackageIdentifier, Map PackageIdentifier GhcPkgId, IsMutable)
        )
 processDep pkgId name value = do
-  mLatestApplicable <- getLatestApplicableVersionAndRev name range
   eRes <- getCachedDepOrAddDep name
   case eRes of
     Left e -> do
@@ -848,6 +847,7 @@
             -- spamming the user too much
             DependencyPlanFailures _ _  ->
               Couldn'tResolveItsDependencies version
+      mLatestApplicable <- getLatestApplicableVersionAndRev name range
       pure $ Left (name, (range, mLatestApplicable, bd))
     Right adr
       | isDepTypeLibrary value.depType && not (adrHasLibrary adr) ->
@@ -855,15 +855,17 @@
     Right adr -> do
       addParent
       inRange <- adrInRange pkgId name range adr
-      pure $ if inRange
-        then Right $ processAdr adr
-        else Left
-          ( name
-          , ( range
-            , mLatestApplicable
-            , DependencyMismatch $ adrVersion adr
+      if inRange
+        then pure $ Right $ processAdr adr
+        else do
+          mLatestApplicable <- getLatestApplicableVersionAndRev name range
+          pure $ Left
+            ( name
+            , ( range
+              , mLatestApplicable
+              , DependencyMismatch $ adrVersion adr
+              )
             )
-          )
  where
   range = value.versionRange
   version = pkgVersion pkgId
diff --git a/src/Stack/Build/Source.hs b/src/Stack/Build/Source.hs
--- a/src/Stack/Build/Source.hs
+++ b/src/Stack/Build/Source.hs
@@ -194,9 +194,7 @@
     PLMutable _ -> pure ""
     PLImmutable pli -> do
       let flagToBs (f, enabled) =
-            if enabled
-              then ""
-              else "-" <> fromString (C.unFlagName f)
+            (if enabled then "" else "-") <> fromString (C.unFlagName f)
           flags = map flagToBs $ Map.toList dp.depCommon.flags
           ghcOptions = map display dp.depCommon.ghcOptions
           cabalConfigOpts = map display dp.depCommon.cabalConfigOpts
diff --git a/src/Stack/Constants.hs b/src/Stack/Constants.hs
--- a/src/Stack/Constants.hs
+++ b/src/Stack/Constants.hs
@@ -253,8 +253,9 @@
     [ "ghc-prim"
       -- A magic package
     , "integer-gmp"
-      -- No longer magic > 1.0.3.0. With GHC 9.6.4 at least, there seems to be
-      -- no problem in using it.
+      -- No longer magic > 1.0.3.0 (GHC >= 9.0) and deprecated in favour of
+      -- ghc-bignum. With GHC 9.6.5 at least, there seems to be no problem in
+      -- using it.
     , "integer-simple"
       -- A magic package
     , "base"
@@ -265,17 +266,20 @@
       -- A magic package
     , "dph-seq"
       -- Deprecated in favour of dph-prim-seq, which does not appear to be
-      -- magic. With GHC 9.6.4 at least, there seems to be no problem in using
+      -- magic. With GHC 9.6.5 at least, there seems to be no problem in using
       -- it.
     , "dph-par"
       --  Deprecated in favour of dph-prim-par, which does not appear to be
-      -- magic. With GHC 9.6.4 at least, there seems to be no problem in using
+      -- magic. With GHC 9.6.5 at least, there seems to be no problem in using
       -- it.
     , "ghc"
       -- A magic package
     , "interactive"
-      -- Could not identify information about this package name. With GHC 9.6.4
-      -- at least, there seems to be no problem in using it.
+      -- Type and class declarations at the GHCi command prompt are treated as
+      -- if they were defined in modules all sharing a common package
+      -- interactive. See 'Note [The interactive package]' at
+      -- https://gitlab.haskell.org/ghc/ghc/-/blob/master/compiler/GHC/Runtime/Context.hs
+      -- With GHC 9.6.5 at least, there seems to be no problem in using it.
     , "ghc-bignum"
       -- A magic package
     ]
diff --git a/src/Stack/Init.hs b/src/Stack/Init.hs
--- a/src/Stack/Init.hs
+++ b/src/Stack/Init.hs
@@ -424,9 +424,9 @@
     , "A snapshot resolver dictates the compiler version and the set of packages"
     , "to be used for project dependencies. For example:"
     , ""
-    , "resolver: lts-22.7"
-    , "resolver: nightly-2024-01-20"
-    , "resolver: ghc-9.6.4"
+    , "resolver: lts-22.21"
+    , "resolver: nightly-2024-05-06"
+    , "resolver: ghc-9.6.5"
     , ""
     , "The location of a snapshot can be provided as a file or url. Stack assumes"
     , "a snapshot provided as a file might change, whereas a url resource does not."
diff --git a/src/Stack/Options/SetupParser.hs b/src/Stack/Options/SetupParser.hs
--- a/src/Stack/Options/SetupParser.hs
+++ b/src/Stack/Options/SetupParser.hs
@@ -19,7 +19,7 @@
 setupOptsParser = SetupCmdOpts
   <$> OA.optional (OA.argument readVersion
         (  OA.metavar "GHC_VERSION"
-        <> OA.help "Version of GHC to install, e.g. 9.6.4. (default: install \
+        <> OA.help "Version of GHC to install, e.g. 9.6.5. (default: install \
                    \the version implied by the resolver)"
         ))
   <*> OA.boolFlags False
diff --git a/src/setup-shim/StackSetupShim.hs b/src/setup-shim/StackSetupShim.hs
--- a/src/setup-shim/StackSetupShim.hs
+++ b/src/setup-shim/StackSetupShim.hs
@@ -1,41 +1,156 @@
 {-# LANGUAGE CPP            #-}
 {-# LANGUAGE PackageImports #-}
+
 module StackSetupShim where
-import Main
-#if defined(MIN_VERSION_Cabal)
+
+-- | Stack no longer supports Cabal < 1.24 and, consequently, GHC versions
+-- before GHC 8.0 or base < 4.9.0.0. Consequently, we do not need to test for
+-- the existence of the MIN_VERSION_Cabal macro (provided from GHC 8.0).
+
+import Data.List ( stripPrefix )
+import Distribution.ReadE ( ReadE (..) )
+import Distribution.Simple.Configure ( getPersistBuildConfig )
+-- | Temporary, can be removed if initialBuildSteps restored to Cabal's API.
+#if MIN_VERSION_Cabal(3,11,0)
+import Distribution.Simple.Build ( writeBuiltinAutogenFiles )
+#else
+import Distribution.Simple.Build ( initialBuildSteps )
+#endif
+#if MIN_VERSION_Cabal(3,11,0)
+import Distribution.Simple.Errors ( exceptionMessage )
+#endif
+-- | Temporary, can be removed if initialBuildSteps restored to Cabal's API.
+#if MIN_VERSION_Cabal(3,11,0)
+import Distribution.Simple.LocalBuildInfo
+         ( componentBuildDir, withAllComponentsInBuildOrder )
+#endif
 #if MIN_VERSION_Cabal(3,8,1)
-import Distribution.PackageDescription (PackageDescription, emptyHookedBuildInfo)
+import Distribution.Simple.PackageDescription ( readGenericPackageDescription )
+#elif MIN_VERSION_Cabal(2,2,0)
+-- Avoid confusion with Cabal-syntax module of same name.
+-- readGenericPackageDescription was exported from module
+-- Distribution.PackageDescription.Parsec in Cabal-2.2.0.0.
+import "Cabal" Distribution.PackageDescription.Parsec
+         ( readGenericPackageDescription )
+#elif MIN_VERSION_Cabal(2,0,0)
+-- readPackageDescription was renamed readGenericPackageDescription in
+-- Cabal-2.0.0.2.
+import Distribution.PackageDescription.Parse ( readGenericPackageDescription )
 #else
-import "Cabal" Distribution.PackageDescription (PackageDescription, emptyHookedBuildInfo)
+import Distribution.PackageDescription.Parse ( readPackageDescription )
 #endif
+import Distribution.Simple.Utils
+         ( createDirectoryIfMissingVerbose, findPackageDesc )
+#if MIN_VERSION_Cabal(3,8,1)
+import Distribution.Types.GenericPackageDescription
+         ( GenericPackageDescription (..) )
+#elif MIN_VERSION_Cabal(2,0,0)
+-- Avoid confusion with Cabal-syntax module of same name.
+-- GenericPackageDescription was exported from module
+-- Distribution.Types.GenericPackageDescription in Cabal-2.0.0.2.
+import "Cabal" Distribution.Types.GenericPackageDescription
+         ( GenericPackageDescription (..) )
 #else
-import Distribution.PackageDescription (PackageDescription, emptyHookedBuildInfo)
+import Distribution.PackageDescription ( GenericPackageDescription (..) )
 #endif
-import Distribution.Simple
-import Distribution.Simple.Build
-import Distribution.Simple.Setup (ReplFlags, fromFlag, replDistPref, replVerbosity)
-import Distribution.Simple.LocalBuildInfo (LocalBuildInfo)
-import System.Environment (getArgs)
+-- | Temporary, can be removed if initialBuildSteps restored to Cabal's API.
+#if MIN_VERSION_Cabal(3,11,0)
+import Distribution.Types.ComponentLocalBuildInfo ( ComponentLocalBuildInfo )
+import Distribution.Types.LocalBuildInfo ( LocalBuildInfo )
+import Distribution.Types.PackageDescription ( PackageDescription )
+import Distribution.Verbosity ( Verbosity )
+#endif
+import Distribution.Verbosity ( flagToVerbosity )
+import Main
+-- Before base-4.11.0.0 (GHC 8.4.1), <> was not exported by Prelude.
+#if !MIN_VERSION_base(4,11,0)
+import Data.Semigroup ( (<>) )
+#endif
+import System.Environment ( getArgs )
 
 mainOverride :: IO ()
 mainOverride = do
-    args <- getArgs
-    if "repl" `elem` args && "stack-initial-build-steps" `elem` args
-        then do
-            defaultMainWithHooks simpleUserHooks
-                { preRepl = \_ _ -> pure emptyHookedBuildInfo
-                , replHook = stackReplHook
-                , postRepl = \_ _ _ _ -> pure ()
-                }
-        else main
+  args <- getArgs
+  case args of
+    [arg1, arg2, "repl", "stack-initial-build-steps"] -> stackReplHook arg1 arg2
+    _ -> main
 
-stackReplHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> ReplFlags -> [String] -> IO ()
-stackReplHook pkg_descr lbi hooks flags args = do
-    let distPref = fromFlag (replDistPref flags)
-        verbosity = fromFlag (replVerbosity flags)
-    case args of
-        ("stack-initial-build-steps":rest)
-            | null rest -> initialBuildSteps distPref pkg_descr lbi verbosity
-            | otherwise ->
-                fail "Misuse of running Setup.hs with stack-initial-build-steps, expected no arguments"
-        _ -> replHook simpleUserHooks pkg_descr lbi hooks flags args
+-- | The name of the function is a mismomer, but is kept for historical reasons.
+-- This function relies on Stack calling the 'setup' executable with:
+--
+-- --verbose=<Cabal_verbosity>
+-- --builddir=<path_to_dist_prefix>
+-- repl
+-- stack-initial-build-steps
+stackReplHook :: String -> String -> IO ()
+stackReplHook arg1 arg2 = do
+  let mRawVerbosity = stripPrefix "--verbose=" arg1
+      mRawBuildDir = stripPrefix "--builddir=" arg2
+  case (mRawVerbosity, mRawBuildDir) of
+    (Nothing, _) -> fail $
+      "Misuse of running Setup.hs with stack-initial-build-steps, expected " <>
+      "first argument to start --verbose="
+    (_, Nothing) -> fail $
+      "Misuse of running Setup.hs with stack-initial-build-steps, expected" <>
+      "second argument to start --builddir="
+    (Just rawVerbosity, Just rawBuildDir) -> do
+        let eVerbosity = runReadE flagToVerbosity rawVerbosity
+        case eVerbosity of
+          Left msg1 -> fail $
+            "Unexpected happened running Setup.hs with " <>
+            "stack-initial-build-steps, expected to parse Cabal verbosity: " <>
+            msg1
+          Right verbosity -> do
+            eFp <- findPackageDesc ""
+            case eFp of
+              Left err -> fail $
+                "Unexpected happened running Setup.hs with " <>
+                "stack-initial-build-steps, expected to find a Cabal file: " <>
+                msg2
+               where
+#if MIN_VERSION_Cabal(3,11,0)
+                -- The type of findPackageDesc changed in Cabal-3.11.0.0.
+                msg2 = exceptionMessage err
+#else
+                msg2 = err
+#endif
+              Right fp -> do
+                gpd <-
+#if MIN_VERSION_Cabal(2,0,0)
+                  readGenericPackageDescription verbosity fp
+#else
+                  readPackageDescription verbosity fp
+#endif
+                let pd = packageDescription gpd
+                lbi <- getPersistBuildConfig rawBuildDir
+                initialBuildSteps rawBuildDir pd lbi verbosity
+
+-- | Temporary, can be removed if initialBuildSteps restored to Cabal's API.
+-- Based on the functions of the same name provided by Cabal-3.10.3.0.
+#if MIN_VERSION_Cabal(3,11,0)
+-- | Runs 'componentInitialBuildSteps' on every configured component.
+initialBuildSteps ::
+     FilePath -- ^"dist" prefix
+  -> PackageDescription  -- ^mostly information from the .cabal file
+  -> LocalBuildInfo -- ^Configuration information
+  -> Verbosity -- ^The verbosity to use
+  -> IO ()
+initialBuildSteps distPref pkg_descr lbi verbosity =
+  withAllComponentsInBuildOrder pkg_descr lbi $ \_comp clbi ->
+    componentInitialBuildSteps distPref pkg_descr lbi clbi verbosity
+
+-- | Creates the autogenerated files for a particular configured component.
+componentInitialBuildSteps ::
+     FilePath -- ^"dist" prefix
+  -> PackageDescription  -- ^mostly information from the .cabal file
+  -> LocalBuildInfo -- ^Configuration information
+  -> ComponentLocalBuildInfo
+  -> Verbosity -- ^The verbosity to use
+  -> IO ()
+componentInitialBuildSteps _distPref pkg_descr lbi clbi verbosity = do
+  createDirectoryIfMissingVerbose verbosity True (componentBuildDir lbi clbi)
+  -- Cabal-3.10.3.0 used writeAutogenFiles, that generated and wrote out the
+  -- Paths_<pkg>.hs, PackageInfo_<pkg>.hs, and cabal_macros.h files. This
+  -- appears to be the equivalent function for Cabal-3.11.0.0.
+  writeBuiltinAutogenFiles verbosity pkg_descr lbi clbi
+#endif
diff --git a/stack.cabal b/stack.cabal
--- a/stack.cabal
+++ b/stack.cabal
@@ -1,6 +1,6 @@
 cabal-version:      2.0
 name:               stack
-version:            2.15.5
+version:            2.15.7
 license:            BSD3
 license-file:       LICENSE
 maintainer:         manny@fpcomplete.com
@@ -82,6 +82,7 @@
     doc/SIGNING_KEY.md
     doc/Stack_and_VS_Code.md
     doc/stack_root.md
+    doc/stack_work.md
     doc/stack_yaml_vs_cabal_package_file.md
     doc/templates_command.md
     doc/travis_ci.md
@@ -107,9 +108,9 @@
 
 custom-setup
     setup-depends:
-        Cabal >=3.10.1.0 && <3.12,
+        Cabal >=3.10.3.0 && <3.12,
         base >=4.14.3.0 && <5,
-        filepath >=1.4.200.1
+        filepath >=1.4.300.1
 
 flag developer-mode
     description: By default, output extra developer information.
@@ -379,20 +380,20 @@
         conduit-extra >=1.3.6,
         containers >=0.6.7,
         crypton >=0.34,
-        directory >=1.3.8.1,
+        directory >=1.3.8.4,
         echo >=0.1.4,
         exceptions >=0.10.7,
         extra >=1.7.14,
-        file-embed >=0.0.15.0,
+        file-embed >=0.0.16.0,
         filelock >=0.1.1.7,
-        filepath >=1.4.200.1,
+        filepath >=1.4.300.1,
         fsnotify >=0.4.1,
         generic-deriving >=1.14.5,
-        ghc-boot >=9.6.4,
+        ghc-boot >=9.6.5,
         hi-file-parser >=0.1.6.0,
         hpack >=0.36.0,
         hpc >=0.6.2.0,
-        http-client >=0.7.16,
+        http-client >=0.7.17,
         http-client-tls >=0.3.6.2,
         http-conduit >=2.3.8.3,
         http-download >=0.2.1.0,
@@ -412,7 +413,7 @@
         pretty >=1.1.3.6,
         process >=1.6.13.2,
         project-template >=0.2.1.0,
-        random >=1.2.1.1,
+        random >=1.2.1.2,
         rio >=0.1.22.0,
         rio-prettyprint >=0.1.8.0,
         split >=0.2.5,
@@ -506,20 +507,20 @@
         conduit-extra >=1.3.6,
         containers >=0.6.7,
         crypton >=0.34,
-        directory >=1.3.8.1,
+        directory >=1.3.8.4,
         echo >=0.1.4,
         exceptions >=0.10.7,
         extra >=1.7.14,
-        file-embed >=0.0.15.0,
+        file-embed >=0.0.16.0,
         filelock >=0.1.1.7,
-        filepath >=1.4.200.1,
+        filepath >=1.4.300.1,
         fsnotify >=0.4.1,
         generic-deriving >=1.14.5,
-        ghc-boot >=9.6.4,
+        ghc-boot >=9.6.5,
         hi-file-parser >=0.1.6.0,
         hpack >=0.36.0,
         hpc >=0.6.2.0,
-        http-client >=0.7.16,
+        http-client >=0.7.17,
         http-client-tls >=0.3.6.2,
         http-conduit >=2.3.8.3,
         http-download >=0.2.1.0,
@@ -539,7 +540,7 @@
         pretty >=1.1.3.6,
         process >=1.6.13.2,
         project-template >=0.2.1.0,
-        random >=1.2.1.1,
+        random >=1.2.1.2,
         rio >=0.1.22.0,
         rio-prettyprint >=0.1.8.0,
         split >=0.2.5,
@@ -613,21 +614,21 @@
         conduit-extra >=1.3.6,
         containers >=0.6.7,
         crypton >=0.34,
-        directory >=1.3.8.1,
+        directory >=1.3.8.4,
         echo >=0.1.4,
         exceptions >=0.10.7,
         extra >=1.7.14,
-        file-embed >=0.0.15.0,
+        file-embed >=0.0.16.0,
         filelock >=0.1.1.7,
-        filepath >=1.4.200.1,
+        filepath >=1.4.300.1,
         fsnotify >=0.4.1,
         generic-deriving >=1.14.5,
-        ghc-boot >=9.6.4,
+        ghc-boot >=9.6.5,
         hi-file-parser >=0.1.6.0,
         hpack >=0.36.0,
         hpc >=0.6.2.0,
-        hspec >=2.11.7,
-        http-client >=0.7.16,
+        hspec >=2.11.8,
+        http-client >=0.7.17,
         http-client-tls >=0.3.6.2,
         http-conduit >=2.3.8.3,
         http-download >=0.2.1.0,
@@ -648,7 +649,7 @@
         pretty >=1.1.3.6,
         process >=1.6.13.2,
         project-template >=0.2.1.0,
-        random >=1.2.1.1,
+        random >=1.2.1.2,
         rio >=0.1.22.0,
         rio-prettyprint >=0.1.8.0,
         split >=0.2.5,
@@ -738,21 +739,21 @@
         conduit-extra >=1.3.6,
         containers >=0.6.7,
         crypton >=0.34,
-        directory >=1.3.8.1,
+        directory >=1.3.8.4,
         echo >=0.1.4,
         exceptions >=0.10.7,
         extra >=1.7.14,
-        file-embed >=0.0.15.0,
+        file-embed >=0.0.16.0,
         filelock >=0.1.1.7,
-        filepath >=1.4.200.1,
+        filepath >=1.4.300.1,
         fsnotify >=0.4.1,
         generic-deriving >=1.14.5,
-        ghc-boot >=9.6.4,
+        ghc-boot >=9.6.5,
         hi-file-parser >=0.1.6.0,
         hpack >=0.36.0,
         hpc >=0.6.2.0,
-        hspec >=2.11.7,
-        http-client >=0.7.16,
+        hspec >=2.11.8,
+        http-client >=0.7.17,
         http-client-tls >=0.3.6.2,
         http-conduit >=2.3.8.3,
         http-download >=0.2.1.0,
@@ -772,7 +773,7 @@
         pretty >=1.1.3.6,
         process >=1.6.13.2,
         project-template >=0.2.1.0,
-        random >=1.2.1.1,
+        random >=1.2.1.2,
         raw-strings-qq >=1.1,
         rio >=0.1.22.0,
         rio-prettyprint >=0.1.8.0,
diff --git a/stack.yaml b/stack.yaml
--- a/stack.yaml
+++ b/stack.yaml
@@ -1,16 +1,8 @@
-snapshot: lts-22.7 # GHC 9.6.4
-
-extra-deps:
-# Cabal is pruned because process is a GHC boot package, and has to be specified
-# again.
-- Cabal-3.10.1.0@sha256:6d11adf7847d9734e7b02785ff831b5a0d11536bfbcefd6634b2b08411c63c94,12316
-- pantry-0.9.3.2@sha256:336373d8cbb10505ff16ac6e35cb9d8a7f45293a908de1c00f55c133ee7dde86,7511
-# GHC 9.6.4 comes with process-1.6.17.0, which can segfault on macOS.
-- process-1.6.18.0@sha256:cd0a3e0376b5a8525983d3131a31e52f9ffefc278ce635eec45a9d3987b8be3e,3025
+snapshot: lts-22.21 # GHC 9.6.5
 
 docker:
   enable: false
-  repo: quay.io/benz0li/ghc-musl:9.6.4
+  repo: quay.io/benz0li/ghc-musl:9.6.5
 
 nix:
   # --nix on the command-line to enable.
@@ -19,7 +11,5 @@
   - unzip
 
 flags:
-  hackage-security:
-    cabal-syntax: true
   stack:
     developer-mode: true
diff --git a/tests/integration/lib/StackTest.hs b/tests/integration/lib/StackTest.hs
--- a/tests/integration/lib/StackTest.hs
+++ b/tests/integration/lib/StackTest.hs
@@ -363,7 +363,7 @@
 -- the main @stack.yaml@.
 --
 defaultResolverArg :: String
-defaultResolverArg = "--snapshot=lts-22.7"
+defaultResolverArg = "--snapshot=lts-22.21"
 
 -- | Remove a file and ignore any warnings about missing files.
 removeFileIgnore :: HasCallStack => FilePath -> IO ()
diff --git a/tests/unit/Stack/ConfigSpec.hs b/tests/unit/Stack/ConfigSpec.hs
--- a/tests/unit/Stack/ConfigSpec.hs
+++ b/tests/unit/Stack/ConfigSpec.hs
@@ -53,12 +53,12 @@
 
 sampleConfig :: String
 sampleConfig =
-  "snapshot: lts-22.7\n" ++
+  "snapshot: lts-22.21\n" ++
   "packages: ['.']\n"
 
 buildOptsConfig :: String
 buildOptsConfig =
-  "snapshot: lts-22.7\n" ++
+  "snapshot: lts-22.21\n" ++
   "packages: ['.']\n" ++
   "build:\n" ++
   "  library-profiling: true\n" ++
@@ -101,7 +101,7 @@
 
 buildOptsHaddockForHackageConfig :: String
 buildOptsHaddockForHackageConfig =
-  "snapshot: lts-22.7\n" ++
+  "snapshot: lts-22.21\n" ++
   "packages: ['.']\n" ++
   "build:\n" ++
   "  haddock: true\n" ++
@@ -114,24 +114,24 @@
 
 hpackConfig :: String
 hpackConfig =
-  "snapshot: lts-22.7\n" ++
+  "snapshot: lts-22.21\n" ++
   "with-hpack: /usr/local/bin/hpack\n" ++
   "packages: ['.']\n"
 
 resolverConfig :: String
 resolverConfig =
-  "resolver: lts-22.7\n" ++
+  "resolver: lts-22.21\n" ++
   "packages: ['.']\n"
 
 snapshotConfig :: String
 snapshotConfig =
-  "snapshot: lts-22.7\n" ++
+  "snapshot: lts-22.21\n" ++
   "packages: ['.']\n"
 
 resolverSnapshotConfig :: String
 resolverSnapshotConfig =
-  "resolver: lts-22.7\n" ++
-  "snapshot: lts-22.7\n" ++
+  "resolver: lts-22.21\n" ++
+  "snapshot: lts-22.21\n" ++
   "packages: ['.']\n"
 
 stackDotYaml :: Path Rel File
@@ -181,11 +181,11 @@
 
     it "parses snapshot using 'resolver'" $ inTempDir $ do
       loadProject resolverConfig $ \project ->
-        project.resolver `shouldBe` RSLSynonym (LTS 22 7)
+        project.resolver `shouldBe` RSLSynonym (LTS 22 21)
 
     it "parses snapshot using 'snapshot'" $ inTempDir $ do
       loadProject snapshotConfig $ \project ->
-        project.resolver `shouldBe` RSLSynonym (LTS 22 7)
+        project.resolver `shouldBe` RSLSynonym (LTS 22 21)
 
     it "throws if both 'resolver' and 'snapshot' are present" $ inTempDir $ do
       loadProject resolverSnapshotConfig (const (pure ()))
@@ -306,7 +306,7 @@
             packageYaml =
               childRel </> either impureThrow id (parseRelFile "package.yaml")
         createDirectoryIfMissing True $ toFilePath $ parent yamlAbs
-        writeFile (toFilePath yamlAbs) "snapshot: ghc-9.6.4"
+        writeFile (toFilePath yamlAbs) "snapshot: ghc-9.6.5"
         writeFile (toFilePath packageYaml) "name: foo"
         withEnvVar "STACK_YAML" (toFilePath yamlRel) $
           loadConfig' $ \config -> liftIO $ do
