{"id":21573509,"url":"https://github.com/haskell/cabal-cache","last_synced_at":"2025-12-11T23:19:32.669Z","repository":{"id":34479051,"uuid":"179578331","full_name":"haskell/cabal-cache","owner":"haskell","description":"CI assistant","archived":false,"fork":false,"pushed_at":"2025-06-01T05:05:14.000Z","size":665,"stargazers_count":48,"open_issues_count":16,"forks_count":11,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-12-05T23:26:23.730Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haskell.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-04T21:15:32.000Z","updated_at":"2025-11-18T08:21:31.000Z","dependencies_parsed_at":"2024-02-09T09:42:34.320Z","dependency_job_id":"14760f60-3cab-4822-9096-b3814a56bbc8","html_url":"https://github.com/haskell/cabal-cache","commit_stats":{"total_commits":291,"total_committers":8,"mean_commits":36.375,"dds":0.4226804123711341,"last_synced_commit":"f66d21b47b44aea0428e974acb2fb09b4021d26b"},"previous_names":["haskell-works/hw-ci-assist","haskell/cabal-cache"],"tags_count":54,"template":false,"template_full_name":null,"purl":"pkg:github/haskell/cabal-cache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fcabal-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fcabal-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fcabal-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fcabal-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haskell","download_url":"https://codeload.github.com/haskell/cabal-cache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell%2Fcabal-cache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27672066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-11T02:00:11.302Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T12:04:58.036Z","updated_at":"2025-12-11T23:19:32.650Z","avatar_url":"https://github.com/haskell.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cabal-cache\n[![master](https://circleci.com/gh/haskell-works/cabal-cache/tree/master.svg?style=svg)](https://circleci.com/gh/haskell-works/cabal-cache/tree/master)\n\nTool for caching built cabal new-build packages.\n\nThe tool is useful in development when you want to share your build haskell package dependencies of\nof a particular project with another developer and also in CI where caching is useful for reducing\nbuild times.\n\n`cabal-cache` supports syncing to an archive directory or to an S3 bucket.\n\n## Installation\n\nSeveral installation methods are available.\n\n### From source\n\n```bash\ncabal new-install cabal-cache\n```\n\n### Binaries\n\nDowload binaries from https://github.com/haskell-works/cabal-cache/releases\n\n### Using Homebrew on Mac OS X\n\n```bash\nbrew tap haskell-works/homebrew-haskell-works git@github.com:haskell-works/homebrew-haskell-works.git\nbrew update\nbrew install cabal-cache\n```\n\n## Example usage\n\nSyncing built packages with S3 requires you have an S3 bucket with AWS\ncredentials stored in the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environent variables.\nYou should also know the AWS region the bucket was created in.\n\n### Sync to archive\n\nChange into your project directory.\n\nBuild the project with `cabal v2-build`.  This will ensure your dependencies are built and\nwill produce a `plan.json` file that is required for the `cabal-cache` tool to know which built\npackages to sync up.\n\nRun the following command to sync to S3.\n\n```bash\ncabal-cache sync-to-archive --threads 16 --archive-uri s3://my-cabal-cache-bucket/archive --region Sydney\n```\n\nRun the following command to sync to archive directory.\n\n```bash\ncabal-cache sync-to-archive --threads 16 --archive-uri archive --region Sydney\n```\n\n### Sync from S3\n\nChange into your project directory.\n\nBuild the project with `cabal v2-configure`.  This will product a `plan.json` file that is required\nfor the `cabal-cache` tool to know which built packages to sync down.\n\nRun the following command to sync from S3.\n\n```bash\ncabal-cache sync-from-archive --threads 16 --archive-uri s3://my-cabal-cache-bucket/archive --region Sydney\n```\n\nRun the following command to sync from archive directory.\n\n```bash\ncabal-cache sync-from-archive --threads 16 --archive-uri archive --region Sydney\n```\n\n### Multicloud\n\nTo run against a different service, use something like:\n\n```bash\ncabal-cache sync-to-archive --threads 16 --archive-uri s3://my-cabal-cache-bucket/archive --host-name-override=s3.us-west.some-service.com --host-port-override=443 --host-ssl-override=True\n```\n\n## The archive\n\n### Archive tarball format\n\nBuilt packages are stored in tarballs which contain the following files:\n\n```bash\nx ${compiler_id}/${package_id}/_CC_METADATA/store-path\nx ${compiler_id}/lib/libHS${package_id}-*.dylib\nx ${compiler_id}/${package_id}\nx ${compiler_id}/package.db/${package_id}.conf\n```\n\nAside from the files in the `_CC_METADATA` directory, everything else is copied verbatim from cabal\nstore from the corresponding location.  This includes the `conf` file which may contain absolute paths\nthat would cause the built package to be non-relocatable.\n\nAs a work-around, the tarball also inclues the `_CC_METADATA/store-path`\nfile which stores the cabal store path from which the cached package was derived.\n\nUpon unpacking, `cabal-cache` will rewrite the `conf` file to contain the new store path using the\ninformation store in the `_CC_METADATA/store-path` file.  `_CC_METADATA` directory and its contents\nwill be additionally unpacked making it easy to recognise packages that have been restored using\n`cabal-cache`.\n\n### Archive directory structure\n\nThe archive contains files in the following locations:\n\n```bash\n/Users/jky/moo-archive/${archive_version}/${compiler_id}/${package_id}.tar.gz\n/Users/jky/moo-archive/${archive_version}/${store_hash}/${compiler_id}/${package_id}.tar.gz\n```\n\nBoth tarballs are identical.  If they both exist then the first may be a symlink to the second\nwhen store on the filesystem.\n\nThe direct subdirectories of the archive is the `${archive_verson}`, for example `v2`.  This is the\nversion of the archive format.  This corresponds to the major version of the `cabal-cache` package.\n\nThe next directory may be the `${store_hash}` or the `${compiler_id}`.  If it is the `${store_hash}`\nthen the `${compiler_id}` will be a subdirectory of that.\n\nThe `${store_hash}` is the hash of the store path from which the cached package originally came.\n\n`cabal-cache` will preferentially restore using this version if it is available and the `${store_hash}`\nmatches the cabal store path that is being restore to.\n\nIf the package matching the `${store_hash}` cannot be found, `cabal-cache` will fallback to the version\nwithout the `${store_hash}`.\n\nA version without a `${store-hash}` may not exist.  See [Caveats](#caveats) for more information.\n\n## Caveats\n\n### Packages that use absolute paths to the cabal store\n\nPackages sometimes do things that cause their built artefacts to contain absolute paths to the cabal\nstore.  This unfortunately makes such built packages non-relocatable.\n\nIt is recommended that you use a fixed cabal store path rather than the default `$HOME/.cabal/store`\nto avoid any potential issues.\n\nSee https://github.com/haskell/cabal/issues/4097 for more information.\n\nFollowing are examples of how this might happen:\n\n#### Paths_$pkgname\n\n`Paths_$pkgname` modules have embedded within them the absolute path to the package in the cabal store\nwhich means that packages that use some features of this module are not relocatable depending on what\nthey do.\n\nPackages may query this module to get access to the package's cabal store `share` directory which\ncontains data files that the package can read at runtime.  Using `cabal-cache` for such packages\ncould mean that the package will be unable to find such data files.\n\nTo protect against this, `cabal-cache` will by default not sync packages down from the archive\nif the package's cabal store `share` directory contain unusual files or directories _unless_ the\n`${store_hash}` matches.  Currently it only considers the `doc` subdirectory to be usual.  More\nexceptions may be added later.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskell%2Fcabal-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaskell%2Fcabal-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskell%2Fcabal-cache/lists"}