Skip to content

Commit 3afae30

Browse files
committed
Fix ghc-9.12 nix build
This fixes builds for the dependencies haskell-language-server and proto-lens. proto-lens 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. The previous haskell-language-server did not support ghc-9.12, so we are upgrading it to the latest version
1 parent 1f27fb3 commit 3afae30

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

flake.nix

Lines changed: 23 additions & 3 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,15 +223,14 @@
202223

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

207229
shell = {
208230
tools = {
209231
cabal = "3.14.2.0";
210232

211-
haskell-language-server = {
212-
src = nixpkgs.haskell-nix.sources."hls-2.11";
213-
};
233+
haskell-language-server = "2.13.0.0";
214234
} // lib.optionalAttrs (config.compiler-nix-name == "ghc967") {
215235
# These versions work with GHC 9.6, but not with 9.10 and 9.12
216236
fourmolu = "0.17.0.0";

0 commit comments

Comments
 (0)