diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c53a37e264498d45ea540b845144cdc454b846f2..71193b8bb264a14f4e92c508be62c19bb137b725 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -33,6 +33,8 @@ variables:
   # builds. This is instantiated with, e.g., -dcore-lint during GHC validation
   # builds.
 
+  # ONLY_PACKAGES can be passed to restrict set of packages that are built.
+
   # EXTRA_OPTS are passed directly to test-patches.
 
   # Multi-project pipeline variables:
diff --git a/run-ci b/run-ci
index d0e63ad35d45dfd80f45098bb829b50390e54bc1..f2882905a307f3376e35fe469c0a6f63975b2d34 100755
--- a/run-ci
+++ b/run-ci
@@ -1,5 +1,14 @@
 #!/usr/bin/env bash
 
+# Relevant environment variables:
+#
+#    GHC                  (required) compiler to build with
+#    CI_CONFIG                       configuration file
+#    EXTRA_OPTS                      extra options passed to test-patches
+#    USE_NIX                         if 1, use nix to provide build dependencies
+#    ONLY_PACKAGES                   restrict set of packages to build
+#
+
 set -e
 
 cd ci
@@ -49,6 +58,8 @@ else
   cabal new-install head-hackage-ci --installdir=$bindir
 fi
 
+ONLY_PACKAGES=( $ONLY_PACKAGES )
+
 cd run
 rm -f cabal.project
 set -x
@@ -58,4 +69,5 @@ $run \
   --patches=../../patches \
   --with-compiler=$GHC \
   $EXTRA_OPTS \
+  ${ONLY_PACKAGES[@]/#/-o} \
   --ghc-option="$EXTRA_HC_OPTS"