diff --git a/cross-js.nix b/cross-js.nix index 8dcf921..1f18f9e 100644 --- a/cross-js.nix +++ b/cross-js.nix @@ -61,14 +61,21 @@ pkgs.mkShell ({ inherit (quirks) CABAL_PROJECT_LOCAL_TEMPLATE; - shellHook = with pkgs; '' + shellHook = + with pkgs; + let flavor = "${compiler-nix-name}-js" + + lib.optionalString (!withHLS && !withHlint) "-minimal" + + lib.optionalString withIOG "-iog" + ; + in '' export PS1="\[\033[01;33m\][\w]$\[\033[00m\] " ${figlet}/bin/figlet -f rectangles 'IOG Haskell Shell' ${figlet}/bin/figlet -f small "*= JS edition =*" echo "Revision (input-output-hk/devx): ${if self ? rev then self.rev else "unknown/dirty checkout"}." export CABAL_DIR=$HOME/.cabal-js echo "CABAL_DIR set to $CABAL_DIR" - '' + quirks.shellHook; + echo "" + '' + (quirks.hint flavor) + quirks.shellHook; buildInputs = []; nativeBuildInputs = [ wrapped-hsc2hs wrapped-cabal compiler ] ++ (with pkgs; [ diff --git a/cross-windows.nix b/cross-windows.nix index ab4e3d3..8d33ffa 100644 --- a/cross-windows.nix +++ b/cross-windows.nix @@ -143,14 +143,21 @@ pkgs.pkgsBuildBuild.mkShell ({ inherit (quirks) CABAL_PROJECT_LOCAL_TEMPLATE; - shellHook = with pkgs; '' + shellHook = + with pkgs; + let flavor = "${compiler-nix-name}-windows" + + lib.optionalString (!withHLS && !withHlint) "-minimal" + + lib.optionalString withIOG "-iog" + ; + in '' export PS1="\[\033[01;33m\][\w]$\[\033[00m\] " ${pkgsBuildBuild.figlet}/bin/figlet -f rectangles 'IOG Haskell Shell' ${pkgsBuildBuild.figlet}/bin/figlet -f small "*= Windows =*" echo "Revision (input-output-hk/devx): ${if self ? rev then self.rev else "unknown/dirty checkout"}." export CABAL_DIR=$HOME/.cabal-windows echo "CABAL_DIR set to $CABAL_DIR" - '' + quirks.shellHook; + echo "" + '' + (quirks.hint flavor) + quirks.shellHook; buildInputs = []; nativeBuildInputs = [ wrapped-ghc wrapped-hsc2hs wrapped-cabal wine-test-wrapper compiler ] ++ (with pkgs; [ diff --git a/dynamic.nix b/dynamic.nix index 14dee68..0dcdb29 100644 --- a/dynamic.nix +++ b/dynamic.nix @@ -45,12 +45,20 @@ let tool-version-map = import ./tool-map.nix; esac ''; }; + quirks = (import ./quirks.nix { inherit pkgs; }); in pkgs.mkShell { # The `cabal` overrride in this shell-hook doesn't do much yet. But # we may need to massage cabal a bit, so we'll leave it in here for # consistency with the one in static.nix. - shellHook = with pkgs; '' + shellHook = + with pkgs; + let flavor = "${compiler-nix-name}" + + lib.optionalString (!withHLS && !withHlint) "-minimal" + + lib.optionalString withIOG "-iog" + + lib.optionalString withIOGFull "-full" + ; + in '' export PS1="\[\033[01;33m\][\w]$\[\033[00m\] " ${figlet}/bin/figlet -f rectangles 'IOG Haskell Shell' echo "Revision (input-output-hk/devx): ${if self ? rev then self.rev else "unknown/dirty checkout"}." @@ -59,7 +67,8 @@ pkgs.mkShell { # incompatbile. export CABAL_DIR=$HOME/.cabal-devx echo "CABAL_DIR set to $CABAL_DIR" - '' + echo "" + '' + (quirks.hint flavor) # this one is only needed on macOS right now, due to a bug in loading libcrypto. # The build will error with -6 due to "loading libcrypto in an unsafe way" + lib.optionalString stdenv.hostPlatform.isMacOS diff --git a/quirks.nix b/quirks.nix index 26a61df..27c8a7b 100644 --- a/quirks.nix +++ b/quirks.nix @@ -18,5 +18,13 @@ function patchProjectLocal() { cat ${template} >> "$1" } + echo "" + ''; + hint = flavor: '' + if [ "$GITHUB_ACTIONS" = "true" ]; then + echo "::notice::Hint: 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 ''; } diff --git a/static.nix b/static.nix index ffe8ba6..e282744 100644 --- a/static.nix +++ b/static.nix @@ -87,7 +87,13 @@ pkgs.mkShell (rec { # the system path. DYLD_LIBRARY_PATH= with pkgs; "${lib.getLib openssl}/lib"; - shellHook = with pkgs; '' + shellHook = + with pkgs; + let flavor = "${compiler-nix-name}-static" + + lib.optionalString (!withHLS && !withHlint) "-minimal" + + lib.optionalString withIOG "-iog" + ; + in '' export PS1="\[\033[01;33m\][\w]$\[\033[00m\] " export DYLD_LIBRARY_PATH="${DYLD_LIBRARY_PATH}"; ${figlet}/bin/figlet -f rectangles 'IOG Haskell Shell' @@ -97,7 +103,8 @@ pkgs.mkShell (rec { export CABAL_DIR=$HOME/.cabal-static echo "CABAL_DIR set to $CABAL_DIR" echo "DYLD_LIBRARY_PATH set to $DYLD_LIBRARY_PATH" - '' + quirks.shellHook; + echo "" + '' + (quirks.hint flavor) + quirks.shellHook; # these are _target_ libs, e.g. ones we want to link the build # product against. These are also the ones that showup in the # PKG_CONFIG_PATH.