diff --git a/.circleci/config.yml b/.circleci/config.yml
index e778c0f93d5143a1608fa2712dc80f30d74dfd41..da126d8a83de1c0378b9b5907d178320022b2854 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -74,6 +74,42 @@ jobs:
             - paymentserver-v1-{{ checksum "stack.yaml" }}-{{ checksum "PaymentServer.cabal" }}
             - paymentserver-v1-{{ checksum "stack.yaml" }}
 
+      - run:
+          # Build just our dependencies.  It's nice to have this as a separate
+          # step so failures here are more easily identified as being
+          # unrelated to our code.
+          #
+          # See below for explanation of the various flags passed in.  If the
+          # flags here differ from those below in a way that makes ghc think a
+          # library needs to be rebuilt then we'll build everything twice and
+          # our cache will be useless!  Try not to make that happen.
+          name: "Build Dependencies"
+          command: |
+            BUILD="stack build \
+            --no-terminal \
+            --only-dependencies \
+            --fast \
+            --test \
+            --no-run-tests \
+            --jobs 1 \
+            --interleaved-output"
+            nix-shell shell.nix --run "$BUILD"
+
+          # Give it a good long while.  stripe-core, in particular, can take a
+          # while to build.
+          no_output_timeout: "20m"
+
+      - save_cache:
+          # We can save the stack cache right here.  It will have everything
+          # we want in it now that the dependencies have been built.  And this
+          # way we get to save the cache whether or not the test suite goes on
+          # to succeed.
+          name: "Cache Dependencies"
+          key: paymentserver-v1-{{ checksum "stack.yaml" }}-{{ checksum "PaymentServer.cabal" }}
+          paths:
+            - "/root/.stack"
+            - ".stack-work"
+
       - run:
           name: "Run Tests"
           command: |
@@ -112,13 +148,6 @@ jobs:
               --no-haddock-deps"
             nix-shell shell.nix --run "$BUILD"
 
-      - save_cache:
-          name: "Cache Dependencies"
-          key: paymentserver-v1-{{ checksum "stack.yaml" }}-{{ checksum "PaymentServer.cabal" }}
-          paths:
-            - "/root/.stack"
-            - ".stack-work"
-
       - save_cache:
           name: "Cache Nix Store Paths"
           key: paymentserver-nix-store-v1-{{ .Environment.NIXPKGS_REV }}
diff --git a/stack.yaml b/stack.yaml
index 82ee2a90ec939dc789b673ce10afaaab9c1753dd..1249fd0e6e0229b7d6ab7bfb89717e69da9f9016 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -67,4 +67,5 @@ extra-deps:
 
 nix:
   enable: true
+  # https://docs.haskellstack.org/en/stable/nix_integration/#using-a-custom-shellnix-file
   shell-file: "stack-shell.nix"