Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect globally installed GHC and related tools #183

Open
srid opened this issue Jul 21, 2023 · 0 comments
Open

Detect globally installed GHC and related tools #183

srid opened this issue Jul 21, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@srid
Copy link
Owner

srid commented Jul 21, 2023

The following shellHook will warn if the user accidentally ends up using a non-nix-shell haskell tools (such as that of ghcup). Perhaps haskell-flake can provide this as an opt-in module to import (like #160).

        haskellProjects.default = { config, ... }: {
          devShell = {
            mkShellArgs.shellHook = ''
              function samePath {
                [[ "$1" == "$2" ]] || (
                  echo "\n!!! WARNING: Found $1, but expected $2"
                )
              }
              function inNixStore {
                [[ "$1" == $NIX_STORE/* ]] || (
                  echo "\n!!! WARNING: $1 is not in the Nix store"
                )
              }
              inNixStore "$(which ghc)"
              # samePath "$(which ghc)" "${lib.getExe config.outputs.finalPackages.ghc}"
              samePath "$(which cabal)" "${lib.getExe config.outputs.finalPackages.cabal-install}"
              samePath "$(which haskell-language-server)" "${lib.getExe config.outputs.finalPackages.haskell-language-server}"
            '';
          };
        }
@srid srid added documentation Improvements or additions to documentation question Further information is requested labels Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant