Skip to content

Commit c1724dc

Browse files
committed
Fix proto-lens ghc-9.12 build
The proto-lens source-repository-package build fails with: Error: [Cabal-6661] filepath wildcard 'proto-lens-imports/google/protobuf/descriptor.proto' refers to the directory 'proto-lens-imports/google/protobuf', which does not exist or is not a directory. filepath wildcard 'proto-lens-imports/google/protobuf/descriptor.proto' does not match any files. However, SRP is currently required because the released version does not support ghc-9.12.
1 parent 1f27fb3 commit c1724dc

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

flake.nix

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,27 @@
179179
isCross = pkgs:
180180
with pkgs.haskell-nix.haskellLib; isNativeMusl || isCrossHost;
181181

182+
# Fetch proto-lens with submodules and fix symlinks for plan and build phases
183+
protoLensSrc = nixpkgs.fetchgit {
184+
url = "https://github.com/google/proto-lens";
185+
rev = "20de5227947b0c37dd6852dcc6f2db1cd5889cee";
186+
sha256 = "sha256-VUYU2swjU7L8Zdu6Zfz6jo2ulW5uPhAamt2GjH5hZRY=";
187+
fetchSubmodules = true;
188+
};
189+
190+
protoLensSrcFixed = nixpkgs.runCommand "proto-lens-fixed" {} ''
191+
mkdir -p $out
192+
cp -a ${protoLensSrc}/. $out/
193+
chmod -R +w $out
194+
# Fix proto-lens-imports symlink in proto-lens
195+
rm -rf $out/proto-lens/proto-lens-imports/google
196+
cp -r ${protoLensSrc}/google/protobuf/src/google $out/proto-lens/proto-lens-imports/
197+
# Fix proto-src symlink in proto-lens-protobuf-types
198+
rm -rf $out/proto-lens-protobuf-types/proto-src
199+
cp -r ${protoLensSrc}/google/protobuf/src $out/proto-lens-protobuf-types/proto-src
200+
chmod -R -w $out
201+
'';
202+
182203
project = (nixpkgs.haskell-nix.cabalProject' ({ config, lib, pkgs, ... }: rec {
183204
src = ./.;
184205
name = "cardano-db-sync";
@@ -202,6 +223,7 @@
202223

203224
inputMap = {
204225
"https://chap.intersectmbo.org/" = inputs.CHaP;
226+
"https://github.com/google/proto-lens/20de5227947b0c37dd6852dcc6f2db1cd5889cee" = protoLensSrcFixed;
205227
};
206228

207229
shell = {

0 commit comments

Comments
 (0)