-
Notifications
You must be signed in to change notification settings - Fork 9
/
quirks.nix
40 lines (40 loc) · 1.46 KB
/
quirks.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{ pkgs, static ? false }: rec {
CABAL_PROJECT_LOCAL_TEMPLATE = with pkgs; ''
package digest
${if static then "extra-lib-dirs: ${zlib}/lib ${pcre}/lib" else ""}
constraints:
HsOpenSSL +use-pkg-config,
zlib +pkg-config,
pcre-lite +pkg-config
'';
template = pkgs.writeTextFile {
name = "cabal.project.local";
text = CABAL_PROJECT_LOCAL_TEMPLATE;
};
shellHook = ''
echo "Quirks:"
echo -e "\tif you have the zlib, HsOpenSSL, or digest package in your dependency tree, please make sure to"
echo -e "\tcat ${template} >> cabal.project.local"
function patchProjectLocal() {
cat ${template} >> "$1"
}
echo ""
'';
hint = flavor: ''
if [ "$GITHUB_ACTIONS" = "true" ]; then
PREFIX="::notice::Hint:"
else
PREFIX="Hint:"
fi
if [ "$GITHUB_ACTIONS" = "true" ] || [ "$'' + ''{CODESPACE_TOKEN+x}" = "x" ]; then
echo "$PREFIX to reproduce this environment locally, use either:" \
"\`nix develop github:input-output-hk/devx#${flavor}\`, or" \
"\`docker run -it -v \$(pwd):/workspaces ghcr.io/input-output-hk/devx-devcontainer:x86_64-linux.${flavor}\`"
fi
if [ "$'' + ''{CODESPACE_TOKEN+x}" = "x" ]; then
echo "Quirks:"
echo -e "\tThe Haskell VSCode extension might ask you \"How do you want the extension to manage/discover HLS and the relevant toolchain?\""
echo -e "\tChoose \"Manually via PATH\", not \"Automatically via GHCup\""
fi
'';
}