Skip to content

unify pre-commit hook & update Gitpod config #2991

New issue

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

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

Already on GitHub? # to your account

Merged
merged 8 commits into from
Jun 28, 2022

Conversation

kokobd
Copy link
Collaborator

@kokobd kokobd commented Jun 27, 2022

This will close #2967.

Previously:

  • .pre-commit-config.yaml is tracked by Git
  • flake.nix contains an outdated pre-commit config
  • flake.nix relies on the non-existence of .pre-commit-config.yaml to work, so its' broken now
  • Documentation suggests using Nix to generate .pre-commit-config.yaml, which doesn't work now
  • We have no pre-commit support in Gitpod.

In this PR, I unify pre-commit config, preserving .pre-commit-config.yaml

  • Remove pre-commit config from flake.nix. Add pre-commit to shellHook directly (so that people using Nix still benefit from .pre-commit-config.yaml)
  • Add pre-commit to Gitpod configuration
  • Update docs about this. It's no longer required to copy .pre-commit-config.yaml from the docs.
  • Remove .pre-commit-config.yaml from .gitignore

Meanwhile, I make some changes to the Gitpod config, making it easier to use (this PR is written on Gitpod):

  • Cache /nix between workspace restarts. Cache ~/.local, ~/.cabal, ~/.stack and ~/.ghcup in the same way using mount binding. Tedious configuration of environment variables to point cabal, stack and ghcup to /workspace is no longer needed
  • Move the installation of some global tools to .gitpod.Dockerfile. In this way, VSCode will be able to see them without any special configuration.
  • Add EditorConfig extension to .gitpod.yml, as it is required according to our style guidelines.

@drsooch
Copy link
Collaborator

drsooch commented Jun 27, 2022

Can't speak to the Nix changes, but thanks for making the effort to make the config work for all parties :)

@kokobd
Copy link
Collaborator Author

kokobd commented Jun 28, 2022

Some showcase:

Gitpod
image

Nix
image

Running pre-commit (it takes a few seconds for the first run)
image

Copy link
Collaborator

@michaelpj michaelpj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nix stuff works 👍

@kokobd kokobd added the merge me Label to trigger pull request merge label Jun 28, 2022
@mergify mergify bot merged commit 771d8f4 into master Jun 28, 2022
@kokobd kokobd deleted the kokobd/pre-commit-hook-is-broken-2967 branch June 28, 2022 08:54
hololeap pushed a commit to hololeap/haskell-language-server that referenced this pull request Aug 26, 2022
* update Gitpod config

* update nix shellHook & docs

* install pre-commit hook

* add kokobd as code owner to .gitpod.*

* add gen-hie to Gitpod

* add tools for doc

* remove .pre-commit-config.yaml from .gitignore

* set vscode formatter to stylish-haskell in Gitpod
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
merge me Label to trigger pull request merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pre-commit hook is broken in nix
3 participants