-
Notifications
You must be signed in to change notification settings - Fork 1
Migrating precommit hooks from LB #21
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import * as TsFlakeProject from 'typescript-flake-project' | ||
| import * as TsFlakeProject from "typescript-flake-project"; | ||
bladyjoker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export function helloWorld() { | ||
| TsFlakeProject.helloWorld(); | ||
| TsFlakeProject.helloWorld(); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,7 @@ | ||
| import * as TsFlakeProject from 'typescript-flake-project' | ||
bladyjoker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import * as TsFlakeProject from "typescript-flake-project"; | ||
|
|
||
| export function helloWorld() { | ||
| TsFlakeProject.helloWorld(); | ||
| TsFlakeProject.helloWorld(); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| helloWorld(); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| export function helloWorld() { | ||
| console.log("Hello world!"); | ||
bladyjoker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| console.log("Hello world!"); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,9 @@ | |
| # typescriptFlake = ... | ||
| # ... | ||
| # }; | ||
| # flakeModule = { | ||
| # rustMonorepoPreCommit = ... | ||
| # }; | ||
| # ``` | ||
| # This is unfortunately not super easy to do with flake-parts! Some useful | ||
| # links + examples are as follows. | ||
|
|
@@ -16,11 +19,31 @@ | |
| { config, inputs, flake-parts-lib, lib, ... }: { | ||
| options = { | ||
| flake = flake-parts-lib.mkSubmoduleOptions { | ||
| # Expose attributes which are generated by the `perSystem` `lib` options | ||
| # e.g. it gives an option for things like | ||
| # ``` | ||
| # lib.<system>.haskellFlake = .. | ||
| # ``` | ||
| lib = lib.mkOption { | ||
| type = lib.types.lazyAttrsOf (lib.types.lazyAttrsOf (lib.types.functionTo lib.types.attrs)); | ||
| default = { }; | ||
| visible = false; | ||
| }; | ||
|
|
||
| # Expose attributes like | ||
| # ``` | ||
| # flakeModule.rustMonorepoPreCommit = .. | ||
| # ``` | ||
| flakeModule = { | ||
| rustMonorepoPreCommit = lib.mkOption { | ||
| type = lib.types.lazyAttrsOf lib.types.unspecified; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be a |
||
| default = ./pre-commit-hooks/rust-monorepo.nix; | ||
| readOnly = true; | ||
| description = lib.mdDoc ''pre-commit-hooks.nix hook for Rust in a monorepo setting''; | ||
| example = lib.mdDoc ''TODO(bladyjoker)''; | ||
| }; | ||
|
|
||
| }; | ||
| }; | ||
| perSystem = flake-parts-lib.mkPerSystemOption ({ pkgs, pkgsForCtl, pkgsForHaskellNix, pkgsForRust, ... }: { | ||
| options = { | ||
|
|
@@ -81,22 +104,6 @@ | |
| example = lib.mdDoc ''TODO(jaredponn)''; | ||
| }; | ||
|
|
||
| rustMonorepoPreCommit = lib.mkOption { | ||
| type = lib.types.flakeModule; | ||
| default = ./pre-commit-hooks/rust-monorepo.nix; | ||
| readOnly = true; | ||
| description = lib.mdDoc ''pre-commit-hooks.nix hook for Rust in a monorepo setting''; | ||
| example = lib.mdDoc ''TODO(bladyjoker)''; | ||
| }; | ||
|
|
||
| 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)''; | ||
| }; | ||
|
|
||
|
Comment on lines
-92
to
-99
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
| }; | ||
| }; | ||
| }); | ||
|
|
||
This file was deleted.
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is very lovely, thanks! |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,16 @@ | ||
| { flake-parts-lib, lib, ... }: { | ||
| perSystem = flake-parts-lib.mkPerSystemOption ({ pkgs, pkgsForRust, ... }: { | ||
| options = { | ||
| flake-lang.pre-commit-hooks.tools = { | ||
|
|
||
| rustfmt = lib.mkOption { | ||
| type = lib.types.derivation; | ||
| default = pkgsForRust.rustfmt; | ||
| readOnly = false; | ||
| description = lib.mdDoc ''Rust formatter to use for pre-commit hooks''; | ||
| options = { | ||
| perSystem = flake-parts-lib.mkPerSystemOption ({ pkgsForRust, ... }: { | ||
| options = { | ||
| flake-lang.pre-commit-hooks.tools = { | ||
| rustfmt = lib.mkOption { | ||
| type = lib.types.package; | ||
| default = pkgsForRust.rustfmt; | ||
| readOnly = false; | ||
| description = lib.mdDoc ''Rust formatter to use for pre-commit hooks''; | ||
| }; | ||
| }; | ||
|
|
||
| deno = lib.mkOption { | ||
| type = lib.types.derivation; | ||
| default = pkgs.deno; | ||
| readOnly = false; | ||
| description = lib.mdDoc ''Deno tool to use for pre-commit hooks''; | ||
| }; | ||
|
|
||
| }; | ||
| }; | ||
| }); | ||
| }); | ||
| }; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.