devx/quirks.nix
Yvan Sraka 086bfa55b4
Fix [: -v: unary operator expected (#158)
* Fix `[: -v: unary operator expected`

```
/nix/store/1zcy75q3dr61bka5h4r8rf3kv8k18kw3-ghc96-iog-env.sh: line 1944: [: -v: unary operator expected
```
e.g. seen on https://github.com/IntersectMBO/cardano-node/actions/runs/8977554294/job/24656515205?pr=5817, in the Build all step.

* Update quirks.nix
2024-05-13 12:47:07 +00:00

40 lines
1.5 KiB
Nix

{ 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
'';
}