Skip to content

Conversation

@jaredponn
Copy link
Contributor

@jaredponn jaredponn commented Feb 3, 2024

Builds off of: #18

  • Removed ./examples/pre-commit.nix in favour of augmenting
    ./pre-commit.nix

    • Justification: I'd prefer to keep all the pre-commit things in a
      single file.
  • Added a flakeModule.rustMonorepoPreCommit attribute which contains a
    module for formatting rust code

  • Removed deno precommit hooks

  • Ran precommit hooks for TS

@jaredponn jaredponn force-pushed the jared/bladyjoker/flake-lang-migration branch 3 times, most recently from 88622a7 to 7452d19 Compare February 3, 2024 01:30
jared added 2 commits February 2, 2024 18:31
- Removed `./examples/pre-commit.nix` in favour of augmenting
  `./pre-commit.nix`
   - Justification: I'd prefer to keep all the `pre-commit` things in a
     single file.

- Added a `flakeModule.rustMonorepoPreCommit` attribute which contains a
  module for formatting rust code
    - Justification: This copies the API given in
      https://github.com/cachix/pre-commit-hooks.nix/blob/7c54e08a689b53c8a1e5d70169f2ec9e2a68ffaf/flake.nix#L27.
      My reading of this is that we want to expose a flake module which
      enables the rust formatter. @szg251 if we're happy with this, I
      can try to get this patched in `pre-commit-hooks.nix` as a more
      permanent fix.

- Removed deno precommit hooks
    - Justification: originally we rolled our own `deno` precommit
      things because the default was slightly broken. But it has now
      been patched -- see cachix/git-hooks.nix#377
@jaredponn jaredponn force-pushed the jared/bladyjoker/flake-lang-migration branch from 7452d19 to 87aec9e Compare February 3, 2024 01:32
Comment on lines -92 to -99
denoPreCommit = lib.mkOption {
type = lib.types.flakeModule;
default = ./pre-commit-hooks/deno.nix;
readOnly = true;
description = lib.mdDoc ''pre-commit-hooks.nix hook for Deno in a monorepo setting'';
example = lib.mdDoc ''TODO(bladyjoker)'';
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't need to roll our own deno anymore. They fixed this in the main repo

Copy link
Contributor Author

@jaredponn jaredponn Feb 3, 2024

Choose a reason for hiding this comment

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

Although this prompts some discussion. In Rust, it seems we want to export a module which does all the formatting -- do we want to provide this feature for all languages (or none)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what you mean...

AFAIK this is about providing Rust formatting with pre-commit-checks.nix, there were reasons why we had to roll our own. @szg251 any comments?

Copy link
Contributor

@bladyjoker bladyjoker left a comment

Choose a reason for hiding this comment

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

Awesome thanks

# ```
flakeModule = {
rustMonorepoPreCommit = lib.mkOption {
type = lib.types.lazyAttrsOf lib.types.unspecified;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a flakeModule type if there is such a thing?

Comment on lines -92 to -99
denoPreCommit = lib.mkOption {
type = lib.types.flakeModule;
default = ./pre-commit-hooks/deno.nix;
readOnly = true;
description = lib.mdDoc ''pre-commit-hooks.nix hook for Deno in a monorepo setting'';
example = lib.mdDoc ''TODO(bladyjoker)'';
};

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what you mean...

AFAIK this is about providing Rust formatting with pre-commit-checks.nix, there were reasons why we had to roll our own. @szg251 any comments?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is very lovely, thanks!

@bladyjoker bladyjoker merged commit 54e98a0 into bladyjoker/flake-lang-migration Feb 5, 2024
@bladyjoker bladyjoker deleted the jared/bladyjoker/flake-lang-migration branch February 5, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants