From f42f9d5304b7f36798587a28154b2d6041fd287a Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Wed, 7 Jun 2023 16:32:00 -0400
Subject: [PATCH] Support CHK and SDMF directory downloads in the demo

---
 flake.lock               | 652 ++++++++++++++++++++++++++++++++++++---
 flake.nix                |  36 ++-
 gbs-downloader.cabal     |   1 +
 list-dircap/Main.hs      |  14 +-
 nix/haskell-packages.nix |  14 -
 5 files changed, 649 insertions(+), 68 deletions(-)
 delete mode 100644 nix/haskell-packages.nix

diff --git a/flake.lock b/flake.lock
index fbc6412..fd61df1 100644
--- a/flake.lock
+++ b/flake.lock
@@ -64,6 +64,54 @@
         "type": "github"
       }
     },
+    "flake-compat_5": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1673956053,
+        "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
+        "type": "github"
+      },
+      "original": {
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "type": "github"
+      }
+    },
+    "flake-compat_6": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1673956053,
+        "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
+        "type": "github"
+      },
+      "original": {
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "type": "github"
+      }
+    },
+    "flake-compat_7": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1673956053,
+        "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
+        "type": "github"
+      },
+      "original": {
+        "owner": "edolstra",
+        "repo": "flake-compat",
+        "type": "github"
+      }
+    },
     "flake-utils": {
       "locked": {
         "lastModified": 1667395993,
@@ -79,7 +127,7 @@
         "type": "github"
       }
     },
-    "flake-utils_2": {
+    "flake-utils_10": {
       "locked": {
         "lastModified": 1676283394,
         "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
@@ -94,7 +142,7 @@
         "type": "github"
       }
     },
-    "flake-utils_3": {
+    "flake-utils_11": {
       "locked": {
         "lastModified": 1667395993,
         "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
@@ -109,7 +157,7 @@
         "type": "github"
       }
     },
-    "flake-utils_4": {
+    "flake-utils_12": {
       "locked": {
         "lastModified": 1676283394,
         "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
@@ -124,7 +172,7 @@
         "type": "github"
       }
     },
-    "flake-utils_5": {
+    "flake-utils_13": {
       "locked": {
         "lastModified": 1676283394,
         "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
@@ -139,7 +187,7 @@
         "type": "github"
       }
     },
-    "flake-utils_6": {
+    "flake-utils_14": {
       "locked": {
         "lastModified": 1676283394,
         "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
@@ -154,7 +202,22 @@
         "type": "github"
       }
     },
-    "flake-utils_7": {
+    "flake-utils_2": {
+      "locked": {
+        "lastModified": 1676283394,
+        "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "flake-utils_3": {
       "inputs": {
         "systems": "systems"
       },
@@ -172,6 +235,66 @@
         "type": "github"
       }
     },
+    "flake-utils_4": {
+      "locked": {
+        "lastModified": 1676283394,
+        "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "flake-utils_5": {
+      "locked": {
+        "lastModified": 1667395993,
+        "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "flake-utils_6": {
+      "locked": {
+        "lastModified": 1676283394,
+        "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "flake-utils_7": {
+      "locked": {
+        "lastModified": 1667395993,
+        "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
     "flake-utils_8": {
       "locked": {
         "lastModified": 1676283394,
@@ -187,6 +310,24 @@
         "type": "github"
       }
     },
+    "flake-utils_9": {
+      "inputs": {
+        "systems": "systems_2"
+      },
+      "locked": {
+        "lastModified": 1681202837,
+        "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "cfacdce06f30d2b68473a46042957675eebb3401",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
     "gitignore": {
       "inputs": {
         "nixpkgs": [
@@ -212,7 +353,7 @@
     "gitignore_2": {
       "inputs": {
         "nixpkgs": [
-          "tahoe-chk",
+          "tahoe-directory",
           "hs-flake-utils",
           "pre-commit-hooks",
           "nixpkgs"
@@ -235,7 +376,8 @@
     "gitignore_3": {
       "inputs": {
         "nixpkgs": [
-          "tahoe-great-black-swamp",
+          "tahoe-directory",
+          "tahoe-capabilities",
           "hs-flake-utils",
           "pre-commit-hooks",
           "nixpkgs"
@@ -258,7 +400,80 @@
     "gitignore_4": {
       "inputs": {
         "nixpkgs": [
+          "tahoe-directory",
+          "tahoe-chk",
+          "hs-flake-utils",
+          "pre-commit-hooks",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1660459072,
+        "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
+        "owner": "hercules-ci",
+        "repo": "gitignore.nix",
+        "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
+        "type": "github"
+      },
+      "original": {
+        "owner": "hercules-ci",
+        "repo": "gitignore.nix",
+        "type": "github"
+      }
+    },
+    "gitignore_5": {
+      "inputs": {
+        "nixpkgs": [
+          "tahoe-directory",
+          "tahoe-ssk",
+          "hs-flake-utils",
+          "pre-commit-hooks",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1660459072,
+        "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
+        "owner": "hercules-ci",
+        "repo": "gitignore.nix",
+        "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
+        "type": "github"
+      },
+      "original": {
+        "owner": "hercules-ci",
+        "repo": "gitignore.nix",
+        "type": "github"
+      }
+    },
+    "gitignore_6": {
+      "inputs": {
+        "nixpkgs": [
+          "tahoe-directory",
           "tahoe-ssk",
+          "tahoe-capabilities",
+          "hs-flake-utils",
+          "pre-commit-hooks",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1660459072,
+        "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
+        "owner": "hercules-ci",
+        "repo": "gitignore.nix",
+        "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
+        "type": "github"
+      },
+      "original": {
+        "owner": "hercules-ci",
+        "repo": "gitignore.nix",
+        "type": "github"
+      }
+    },
+    "gitignore_7": {
+      "inputs": {
+        "nixpkgs": [
+          "tahoe-great-black-swamp",
           "hs-flake-utils",
           "pre-commit-hooks",
           "nixpkgs"
@@ -306,11 +521,11 @@
         "pre-commit-hooks": "pre-commit-hooks_2"
       },
       "locked": {
-        "lastModified": 1677773826,
-        "narHash": "sha256-xJmOtHugr4k2zNhP/AF6JdIUnIEyM+TEspLn2n5kloc=",
+        "lastModified": 1686149618,
+        "narHash": "sha256-/IHWacNutk3tklouWOgClp7FnOH+Yk6If13kKJMSEi8=",
         "ref": "main",
-        "rev": "d3a83fdd9563546ca41771186427638e685a2e2b",
-        "revCount": 9,
+        "rev": "49696f704eb965f57d729871c6d450ac0aff2b68",
+        "revCount": 12,
         "type": "git",
         "url": "https://whetstone.private.storage/jcalderone/hs-flake-utils.git"
       },
@@ -343,9 +558,72 @@
     },
     "hs-flake-utils_4": {
       "inputs": {
-        "flake-utils": "flake-utils_8",
-        "nixpkgs": "nixpkgs_4",
-        "pre-commit-hooks": "pre-commit-hooks_4"
+        "flake-utils": "flake-utils_8",
+        "nixpkgs": "nixpkgs_4",
+        "pre-commit-hooks": "pre-commit-hooks_4"
+      },
+      "locked": {
+        "lastModified": 1677773826,
+        "narHash": "sha256-xJmOtHugr4k2zNhP/AF6JdIUnIEyM+TEspLn2n5kloc=",
+        "ref": "main",
+        "rev": "d3a83fdd9563546ca41771186427638e685a2e2b",
+        "revCount": 9,
+        "type": "git",
+        "url": "https://whetstone.private.storage/jcalderone/hs-flake-utils.git"
+      },
+      "original": {
+        "ref": "main",
+        "type": "git",
+        "url": "https://whetstone.private.storage/jcalderone/hs-flake-utils.git"
+      }
+    },
+    "hs-flake-utils_5": {
+      "inputs": {
+        "flake-utils": "flake-utils_10",
+        "nixpkgs": "nixpkgs_5",
+        "pre-commit-hooks": "pre-commit-hooks_5"
+      },
+      "locked": {
+        "lastModified": 1681762240,
+        "narHash": "sha256-+PLx9xHBvV70dA7Gy/+YTH1w3PcSOrGV0z0rGxts8jU=",
+        "ref": "main",
+        "rev": "a51e591b7fdf8881ac0237452691df7b1aceecd3",
+        "revCount": 10,
+        "type": "git",
+        "url": "https://whetstone.private.storage/jcalderone/hs-flake-utils.git"
+      },
+      "original": {
+        "ref": "main",
+        "type": "git",
+        "url": "https://whetstone.private.storage/jcalderone/hs-flake-utils.git"
+      }
+    },
+    "hs-flake-utils_6": {
+      "inputs": {
+        "flake-utils": "flake-utils_12",
+        "nixpkgs": "nixpkgs_6",
+        "pre-commit-hooks": "pre-commit-hooks_6"
+      },
+      "locked": {
+        "lastModified": 1681762240,
+        "narHash": "sha256-+PLx9xHBvV70dA7Gy/+YTH1w3PcSOrGV0z0rGxts8jU=",
+        "ref": "main",
+        "rev": "a51e591b7fdf8881ac0237452691df7b1aceecd3",
+        "revCount": 10,
+        "type": "git",
+        "url": "https://whetstone.private.storage/jcalderone/hs-flake-utils.git"
+      },
+      "original": {
+        "ref": "main",
+        "type": "git",
+        "url": "https://whetstone.private.storage/jcalderone/hs-flake-utils.git"
+      }
+    },
+    "hs-flake-utils_7": {
+      "inputs": {
+        "flake-utils": "flake-utils_14",
+        "nixpkgs": "nixpkgs_7",
+        "pre-commit-hooks": "pre-commit-hooks_7"
       },
       "locked": {
         "lastModified": 1681762240,
@@ -442,6 +720,54 @@
         "type": "github"
       }
     },
+    "nixpkgs-stable_5": {
+      "locked": {
+        "lastModified": 1673800717,
+        "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixos-22.11",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "nixpkgs-stable_6": {
+      "locked": {
+        "lastModified": 1673800717,
+        "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixos-22.11",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "nixpkgs-stable_7": {
+      "locked": {
+        "lastModified": 1673800717,
+        "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f",
+        "type": "github"
+      },
+      "original": {
+        "owner": "NixOS",
+        "ref": "nixos-22.11",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
     "nixpkgs_2": {
       "locked": {
         "lastModified": 1677624842,
@@ -490,6 +816,54 @@
         "type": "github"
       }
     },
+    "nixpkgs_5": {
+      "locked": {
+        "lastModified": 1677624842,
+        "narHash": "sha256-4DF9DbDuK4/+KYx0L6XcPBeDHUFVCtzok2fWtwXtb5w=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "d70f5cd5c3bef45f7f52698f39e7cc7a89daa7f0",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "ref": "nixos-22.11",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "nixpkgs_6": {
+      "locked": {
+        "lastModified": 1677624842,
+        "narHash": "sha256-4DF9DbDuK4/+KYx0L6XcPBeDHUFVCtzok2fWtwXtb5w=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "d70f5cd5c3bef45f7f52698f39e7cc7a89daa7f0",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "ref": "nixos-22.11",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
+    "nixpkgs_7": {
+      "locked": {
+        "lastModified": 1677624842,
+        "narHash": "sha256-4DF9DbDuK4/+KYx0L6XcPBeDHUFVCtzok2fWtwXtb5w=",
+        "owner": "nixos",
+        "repo": "nixpkgs",
+        "rev": "d70f5cd5c3bef45f7f52698f39e7cc7a89daa7f0",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nixos",
+        "ref": "nixos-22.11",
+        "repo": "nixpkgs",
+        "type": "github"
+      }
+    },
     "pre-commit-hooks": {
       "inputs": {
         "flake-compat": "flake-compat",
@@ -522,13 +896,13 @@
       "inputs": {
         "flake-compat": "flake-compat_2",
         "flake-utils": [
-          "tahoe-chk",
+          "tahoe-directory",
           "hs-flake-utils",
           "flake-utils"
         ],
         "gitignore": "gitignore_2",
         "nixpkgs": [
-          "tahoe-chk",
+          "tahoe-directory",
           "hs-flake-utils",
           "nixpkgs"
         ],
@@ -552,13 +926,15 @@
       "inputs": {
         "flake-compat": "flake-compat_3",
         "flake-utils": [
-          "tahoe-great-black-swamp",
+          "tahoe-directory",
+          "tahoe-capabilities",
           "hs-flake-utils",
           "flake-utils"
         ],
         "gitignore": "gitignore_3",
         "nixpkgs": [
-          "tahoe-great-black-swamp",
+          "tahoe-directory",
+          "tahoe-capabilities",
           "hs-flake-utils",
           "nixpkgs"
         ],
@@ -582,13 +958,15 @@
       "inputs": {
         "flake-compat": "flake-compat_4",
         "flake-utils": [
-          "tahoe-ssk",
+          "tahoe-directory",
+          "tahoe-chk",
           "hs-flake-utils",
           "flake-utils"
         ],
         "gitignore": "gitignore_4",
         "nixpkgs": [
-          "tahoe-ssk",
+          "tahoe-directory",
+          "tahoe-chk",
           "hs-flake-utils",
           "nixpkgs"
         ],
@@ -608,6 +986,102 @@
         "type": "github"
       }
     },
+    "pre-commit-hooks_5": {
+      "inputs": {
+        "flake-compat": "flake-compat_5",
+        "flake-utils": [
+          "tahoe-directory",
+          "tahoe-ssk",
+          "hs-flake-utils",
+          "flake-utils"
+        ],
+        "gitignore": "gitignore_5",
+        "nixpkgs": [
+          "tahoe-directory",
+          "tahoe-ssk",
+          "hs-flake-utils",
+          "nixpkgs"
+        ],
+        "nixpkgs-stable": "nixpkgs-stable_5"
+      },
+      "locked": {
+        "lastModified": 1677722096,
+        "narHash": "sha256-7mjVMvCs9InnrRybBfr5ohqcOz+pyEX8m22C1XsDilg=",
+        "owner": "cachix",
+        "repo": "pre-commit-hooks.nix",
+        "rev": "61a3511668891c68ebd19d40122150b98dc2fe3b",
+        "type": "github"
+      },
+      "original": {
+        "owner": "cachix",
+        "repo": "pre-commit-hooks.nix",
+        "type": "github"
+      }
+    },
+    "pre-commit-hooks_6": {
+      "inputs": {
+        "flake-compat": "flake-compat_6",
+        "flake-utils": [
+          "tahoe-directory",
+          "tahoe-ssk",
+          "tahoe-capabilities",
+          "hs-flake-utils",
+          "flake-utils"
+        ],
+        "gitignore": "gitignore_6",
+        "nixpkgs": [
+          "tahoe-directory",
+          "tahoe-ssk",
+          "tahoe-capabilities",
+          "hs-flake-utils",
+          "nixpkgs"
+        ],
+        "nixpkgs-stable": "nixpkgs-stable_6"
+      },
+      "locked": {
+        "lastModified": 1677722096,
+        "narHash": "sha256-7mjVMvCs9InnrRybBfr5ohqcOz+pyEX8m22C1XsDilg=",
+        "owner": "cachix",
+        "repo": "pre-commit-hooks.nix",
+        "rev": "61a3511668891c68ebd19d40122150b98dc2fe3b",
+        "type": "github"
+      },
+      "original": {
+        "owner": "cachix",
+        "repo": "pre-commit-hooks.nix",
+        "type": "github"
+      }
+    },
+    "pre-commit-hooks_7": {
+      "inputs": {
+        "flake-compat": "flake-compat_7",
+        "flake-utils": [
+          "tahoe-great-black-swamp",
+          "hs-flake-utils",
+          "flake-utils"
+        ],
+        "gitignore": "gitignore_7",
+        "nixpkgs": [
+          "tahoe-great-black-swamp",
+          "hs-flake-utils",
+          "nixpkgs"
+        ],
+        "nixpkgs-stable": "nixpkgs-stable_7"
+      },
+      "locked": {
+        "lastModified": 1677722096,
+        "narHash": "sha256-7mjVMvCs9InnrRybBfr5ohqcOz+pyEX8m22C1XsDilg=",
+        "owner": "cachix",
+        "repo": "pre-commit-hooks.nix",
+        "rev": "61a3511668891c68ebd19d40122150b98dc2fe3b",
+        "type": "github"
+      },
+      "original": {
+        "owner": "cachix",
+        "repo": "pre-commit-hooks.nix",
+        "type": "github"
+      }
+    },
     "root": {
       "inputs": {
         "flake-utils": "flake-utils",
@@ -616,9 +1090,20 @@
           "hs-flake-utils",
           "nixpkgs"
         ],
-        "tahoe-chk": "tahoe-chk",
+        "tahoe-capabilities": [
+          "tahoe-directory",
+          "tahoe-capabilities"
+        ],
+        "tahoe-chk": [
+          "tahoe-directory",
+          "tahoe-chk"
+        ],
+        "tahoe-directory": "tahoe-directory",
         "tahoe-great-black-swamp": "tahoe-great-black-swamp",
-        "tahoe-ssk": "tahoe-ssk"
+        "tahoe-ssk": [
+          "tahoe-directory",
+          "tahoe-ssk"
+        ]
       }
     },
     "systems": {
@@ -636,11 +1121,76 @@
         "type": "github"
       }
     },
+    "systems_2": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    },
+    "tahoe-capabilities": {
+      "inputs": {
+        "flake-utils": "flake-utils_5",
+        "hs-flake-utils": "hs-flake-utils_3",
+        "nixpkgs": [
+          "tahoe-directory",
+          "hs-flake-utils",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1686164259,
+        "narHash": "sha256-T0U5B/DH+XDEXfBG7cHlTcMec4aUTDd+HH8Bsv0C71Y=",
+        "ref": "refs/heads/main",
+        "rev": "f0a11218007f6c2fe0f6b5e09e0993fe253f6e23",
+        "revCount": 9,
+        "type": "git",
+        "url": "https://whetstone.private.storage/PrivateStorage/tahoe-capabilities"
+      },
+      "original": {
+        "type": "git",
+        "url": "https://whetstone.private.storage/PrivateStorage/tahoe-capabilities"
+      }
+    },
+    "tahoe-capabilities_2": {
+      "inputs": {
+        "flake-utils": "flake-utils_11",
+        "hs-flake-utils": "hs-flake-utils_6",
+        "nixpkgs": [
+          "tahoe-directory",
+          "tahoe-ssk",
+          "hs-flake-utils",
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1686164259,
+        "narHash": "sha256-T0U5B/DH+XDEXfBG7cHlTcMec4aUTDd+HH8Bsv0C71Y=",
+        "ref": "refs/heads/main",
+        "rev": "f0a11218007f6c2fe0f6b5e09e0993fe253f6e23",
+        "revCount": 9,
+        "type": "git",
+        "url": "https://whetstone.private.storage/PrivateStorage/tahoe-capabilities"
+      },
+      "original": {
+        "type": "git",
+        "url": "https://whetstone.private.storage/PrivateStorage/tahoe-capabilities"
+      }
+    },
     "tahoe-chk": {
       "inputs": {
-        "flake-utils": "flake-utils_3",
-        "hs-flake-utils": "hs-flake-utils_2",
+        "flake-utils": "flake-utils_7",
+        "hs-flake-utils": "hs-flake-utils_4",
         "nixpkgs": [
+          "tahoe-directory",
           "hs-flake-utils",
           "nixpkgs"
         ]
@@ -660,10 +1210,36 @@
         "url": "https://whetstone.private.storage/PrivateStorage/tahoe-chk"
       }
     },
+    "tahoe-directory": {
+      "inputs": {
+        "flake-utils": "flake-utils_3",
+        "hs-flake-utils": "hs-flake-utils_2",
+        "nixpkgs": [
+          "hs-flake-utils",
+          "nixpkgs"
+        ],
+        "tahoe-capabilities": "tahoe-capabilities",
+        "tahoe-chk": "tahoe-chk",
+        "tahoe-ssk": "tahoe-ssk"
+      },
+      "locked": {
+        "lastModified": 1686169487,
+        "narHash": "sha256-dXtryScMhtz9N3hu0U+kCIGtRo58BHdP2F8PFqHjmao=",
+        "ref": "refs/heads/main",
+        "rev": "87c750f2c16a290c0fcedef65d2dbebf6a877965",
+        "revCount": 14,
+        "type": "git",
+        "url": "https://whetstone.private.storage/PrivateStorage/tahoe-directory.git"
+      },
+      "original": {
+        "type": "git",
+        "url": "https://whetstone.private.storage/PrivateStorage/tahoe-directory.git"
+      }
+    },
     "tahoe-great-black-swamp": {
       "inputs": {
-        "flake-utils": "flake-utils_5",
-        "hs-flake-utils": "hs-flake-utils_3",
+        "flake-utils": "flake-utils_13",
+        "hs-flake-utils": "hs-flake-utils_7",
         "nixpkgs": [
           "hs-flake-utils",
           "nixpkgs"
@@ -689,29 +1265,31 @@
     },
     "tahoe-ssk": {
       "inputs": {
-        "flake-utils": "flake-utils_7",
-        "hs-flake-utils": "hs-flake-utils_4",
+        "flake-utils": "flake-utils_9",
+        "hs-flake-utils": "hs-flake-utils_5",
         "nixpkgs": [
+          "tahoe-directory",
           "hs-flake-utils",
           "nixpkgs"
         ],
+        "tahoe-capabilities": "tahoe-capabilities_2",
         "tahoe-chk": [
+          "tahoe-directory",
           "tahoe-chk"
         ]
       },
       "locked": {
-        "lastModified": 1685641443,
-        "narHash": "sha256-lgHcvFz6s07HXdGCz1C/dOSVLi0HiAtHiv0Na4QkQEg=",
-        "ref": "refs/tags/0.2.0.0",
-        "rev": "1afe634278c96d61b8acb994ec82a71a6394d032",
-        "revCount": 84,
+        "lastModified": 1686166709,
+        "narHash": "sha256-z+QzmnfmLuqqNFWvlYAVZoS7jBHEj54OZest/sKgDqk=",
+        "ref": "refs/heads/main",
+        "rev": "8f73a87054546c875c3b0284ee4d2f3e0483d963",
+        "revCount": 93,
         "type": "git",
-        "url": "https://whetstone.private.storage/PrivateStorage/tahoe-ssk"
+        "url": "https://whetstone.private.storage/PrivateStorage/tahoe-ssk.git"
       },
       "original": {
-        "ref": "refs/tags/0.2.0.0",
         "type": "git",
-        "url": "https://whetstone.private.storage/PrivateStorage/tahoe-ssk"
+        "url": "https://whetstone.private.storage/PrivateStorage/tahoe-ssk.git"
       }
     }
   },
diff --git a/flake.nix b/flake.nix
index c3c556c..351c046 100644
--- a/flake.nix
+++ b/flake.nix
@@ -7,16 +7,14 @@
     flake-utils.url = github:numtide/flake-utils;
     hs-flake-utils.url = "git+https://whetstone.private.storage/jcalderone/hs-flake-utils.git?ref=main";
 
-    tahoe-chk = {
-      url = "git+https://whetstone.private.storage/PrivateStorage/tahoe-chk?ref=refs/tags/0.1.0.1";
+    tahoe-directory = {
+      url = "git+https://whetstone.private.storage/PrivateStorage/tahoe-directory.git";
       inputs.nixpkgs.follows = "hs-flake-utils/nixpkgs";
     };
 
-    tahoe-ssk = {
-      url = "git+https://whetstone.private.storage/PrivateStorage/tahoe-ssk?ref=refs/tags/0.2.0.0";
-      inputs.nixpkgs.follows = "hs-flake-utils/nixpkgs";
-      inputs.tahoe-chk.follows = "tahoe-chk";
-    };
+    tahoe-chk.follows = "tahoe-directory/tahoe-chk";
+    tahoe-ssk.follows = "tahoe-directory/tahoe-ssk";
+    tahoe-capabilities.follows = "tahoe-directory/tahoe-capabilities";
 
     tahoe-great-black-swamp = {
       url = "git+https://whetstone.private.storage/PrivateStorage/tahoe-great-black-swamp?ref=refs/tags/0.3.0.0";
@@ -32,6 +30,8 @@
     hs-flake-utils,
     tahoe-chk,
     tahoe-ssk,
+    tahoe-capabilities,
+    tahoe-directory,
     tahoe-great-black-swamp,
   }: let
     ulib = flake-utils.lib;
@@ -47,11 +47,16 @@
         src = ./.;
         compilerVersion = ghcVersion;
         packageName = "gbs-downloader";
-        hsPkgsOverrides = import ./nix/haskell-packages.nix {
+        hsPkgsOverrides = hfinal: hprev: {
           tahoe-chk = tahoe-chk.outputs.packages.${system}.default;
           tahoe-ssk = tahoe-ssk.outputs.packages.${system}.default;
+          tahoe-directory = tahoe-directory.outputs.packages.${system}.default;
+          tahoe-capabilities = tahoe-capabilities.outputs.packages.${system}.default;
           tahoe-great-black-swamp = tahoe-great-black-swamp.outputs.packages.${system}.default;
-          haskellLib = pkgs.haskell.lib;
+
+          # A broken dependency of a tahoe-great-black-swamp executable that
+          # we don't use.  Flip the broken bit so we can get a build.
+          language-ecmascript = pkgs.haskell.unmarkBroken hprev.language-ecmascript;
         };
       };
     in {
@@ -65,9 +70,16 @@
             .
             -- These aren't released on hackage yet so we have to get them
             -- another way.  Here, we get them from the Nix store.
-            ${tahoe-ssk} -- tahoe-ssk
-            ${tahoe-chk} -- tahoe-chk
-            ${tahoe-great-black-swamp} -- tahoe-great-black-swamp
+            -- tahoe-chk
+            ${tahoe-chk}
+            -- tahoe-ssk
+            ${tahoe-ssk}
+            -- tahoe-capabilities
+            ${tahoe-capabilities}
+            -- tahoe-directory
+            ${tahoe-directory}
+            -- tahoe-great-black-swamp
+            ${tahoe-great-black-swamp}
           EOF
         '';
         extraBuildInputs = pkgs:
diff --git a/gbs-downloader.cabal b/gbs-downloader.cabal
index 51ec08e..56b04e1 100644
--- a/gbs-downloader.cabal
+++ b/gbs-downloader.cabal
@@ -189,6 +189,7 @@ executable list-dircap
     , containers
     , gbs-downloader
     , megaparsec
+    , tahoe-chk
     , tahoe-directory
     , tahoe-ssk        >=0.2 && <0.3
     , text
diff --git a/list-dircap/Main.hs b/list-dircap/Main.hs
index a075398..c0adc74 100644
--- a/list-dircap/Main.hs
+++ b/list-dircap/Main.hs
@@ -10,7 +10,7 @@ import Tahoe.Announcement (Announcements (..))
 import qualified Tahoe.Directory as TD
 import Text.Megaparsec (parse)
 
-import Tahoe.Download (announcementToMutableStorageServer, downloadDirectory)
+import Tahoe.Download (announcementToImmutableStorageServer, announcementToMutableStorageServer, downloadDirectory)
 
 main :: IO ()
 main = do
@@ -21,12 +21,16 @@ main = do
 
     -- Accept & parse read capability
     case parse TD.pReadSDMF "<argv>" (T.pack dirReadCap) of
-        Left e -> print $ "Failed to parse cap: " <> show e
-        Right r -> go announcements r
+        Right r -> go announcements r announcementToMutableStorageServer
+        Left eSDMF -> case parse TD.pReadCHK "<argv>" (T.pack dirReadCap) of
+            Right r -> go announcements r announcementToImmutableStorageServer
+            Left eCHK -> do
+                print $ "Failed to parse cap: " <> show eSDMF
+                print $ "Failed to parse cap: " <> show eCHK
   where
-    go announcements cap = do
+    go announcements cap lookupServer = do
         -- Download & decode the shares
-        result <- downloadDirectory announcements cap announcementToMutableStorageServer
+        result <- downloadDirectory announcements cap lookupServer
 
         -- Show the result
         putStrLn "Your result:"
diff --git a/nix/haskell-packages.nix b/nix/haskell-packages.nix
deleted file mode 100644
index dbf474b..0000000
--- a/nix/haskell-packages.nix
+++ /dev/null
@@ -1,14 +0,0 @@
-{
-  haskellLib,
-  tahoe-chk,
-  tahoe-ssk,
-  tahoe-great-black-swamp,
-}: hfinal: hprev: {
-  inherit tahoe-chk;
-  inherit tahoe-ssk;
-  inherit tahoe-great-black-swamp;
-
-  # A broken dependency of a tahoe-great-black-swamp executable that we don't
-  # use.  Flip the broken bit so we can get a build.
-  language-ecmascript = haskellLib.unmarkBroken hprev.language-ecmascript;
-}
-- 
GitLab