-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: integrate some initial nixago standard pebbles
- Loading branch information
Showing
9 changed files
with
241 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
inputs, | ||
cell, | ||
}: let | ||
inherit (inputs) nixpkgs; | ||
l = nixpkgs.lib // builtins; | ||
in | ||
l.mapAttrs (_: cell.lib.mkNixago) { | ||
treefmt = { | ||
configData = import ./nixago/treefmt.nix; | ||
output = "treefmt.toml"; | ||
format = "toml"; | ||
packages = [ | ||
nixpkgs.alejandra | ||
nixpkgs.nodePackages.prettier | ||
nixpkgs.nodePackages.prettier-plugin-toml | ||
nixpkgs.shfmt | ||
nixpkgs.treefmt | ||
]; | ||
commands = [{package = nixpkgs.treefmt;}]; | ||
devshell.startup.prettier-plugin-toml = l.stringsWithDeps.noDepEntry '' | ||
export NODE_PATH=${nixpkgs.nodePackages.prettier-plugin-toml}/lib/node_modules:$NODE_PATH | ||
''; | ||
}; | ||
editorconfig = { | ||
configData = import ./nixago/editorconfig.nix; | ||
output = ".editorconfig"; | ||
format = "ini"; | ||
hook.mode = "copy"; # already useful before entering the devshell | ||
packages = [nixpkgs.editorconfig-checker]; | ||
}; | ||
conform = { | ||
configData = import ./nixago/conform.nix; | ||
format = "yaml"; | ||
output = ".conform.yaml"; | ||
packages = [nixpkgs.conform]; | ||
apply = d: { | ||
policies = | ||
[] | ||
++ (l.optional (d ? commit) { | ||
type = "commit"; | ||
spec = d.commit; | ||
}) | ||
++ (l.optional (d ? license) { | ||
type = "license"; | ||
spec = d.license; | ||
}); | ||
}; | ||
}; | ||
lefthook = { | ||
configData = import ./nixago/lefthook.nix; | ||
format = "yaml"; | ||
output = "lefthook.yml"; | ||
packages = [nixpkgs.lefthook]; | ||
hook.extra = d: let | ||
# Add an extra hook for adding required stages whenever the file changes | ||
skip_attrs = [ | ||
"colors" | ||
"extends" | ||
"skip_output" | ||
"source_dir" | ||
"source_dir_local" | ||
]; | ||
stages = l.attrNames (l.removeAttrs d skip_attrs); | ||
stagesStr = l.concatStringsSep " " stages; | ||
in '' | ||
# Install configured hooks | ||
for stage in ${stagesStr}; do | ||
${nixpkgs.lefthook}/bin/lefthook add -a "$stage" | ||
done | ||
''; | ||
}; | ||
mdbook = { | ||
configData = import ./nixago/mdbook.nix; | ||
output = "book.toml"; | ||
format = "toml"; | ||
hook.mode = "copy"; # let CI pick it up outside of devshell | ||
hook.extra = let | ||
sentinel = "nixago-auto-created: mdbook-build-folder"; | ||
file = "docs/.gitignore"; | ||
str = '' | ||
# mdbook build folder; ${sentinel} | ||
book/** | ||
''; | ||
in '' | ||
# Configure gitignore | ||
create () { echo -n "$str" > "${file}" } | ||
append () { echo -en "\n$str" >> "${file}" } | ||
if ! test -f "${file}" | ||
then | ||
create | ||
else if ! grep -qF "${sentinel}" "${file}" | ||
then | ||
append | ||
fi | ||
''; | ||
packages = [cell.packages.mdbook-kroki-preprocessor]; | ||
commands = [{package = nixpkgs.mdbook;}]; | ||
}; | ||
adrgen = { | ||
configData = import ./nixago/adrgen.nix; | ||
output = "treefmt.toml"; | ||
format = "yaml"; | ||
commands = [{package = cell.packages.adrgen;}]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
default_meta = []; | ||
default_status = "proposed"; | ||
directory = "docs/explain/architecture-decision-records"; | ||
id_digit_number = 4; | ||
supported_statuses = [ | ||
"proposed" | ||
"accepted" | ||
"rejected" | ||
"superseded" | ||
"amended" | ||
"deprecated" | ||
]; | ||
template_file = "docs/explain/architecture-decision-records/template.md"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
commit = { | ||
header = {length = 89;}; | ||
conventional = { | ||
types = [ | ||
"build" | ||
"chore" | ||
"ci" | ||
"docs" | ||
"feat" | ||
"fix" | ||
"perf" | ||
"refactor" | ||
"style" | ||
"test" | ||
]; | ||
scopes = []; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
# root = true; | ||
|
||
"*" = { | ||
end_of_line = "lf"; | ||
insert_final_newline = true; | ||
trim_trailing_whitespace = true; | ||
charset = "utf-8"; | ||
indent_style = "space"; | ||
indent_size = 2; | ||
}; | ||
|
||
"*.{diff,patch}" = { | ||
end_of_line = "unset"; | ||
insert_final_newline = "unset"; | ||
trim_trailing_whitespace = "unset"; | ||
indent_size = "unset"; | ||
}; | ||
|
||
"*.md" = { | ||
max_line_length = "off"; | ||
trim_trailing_whitespace = false; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
commit-msg = { | ||
commands = { | ||
conform = { | ||
run = "conform enforce --commit-msg-file {1}"; | ||
}; | ||
}; | ||
}; | ||
pre-commit = { | ||
commands = { | ||
treefmt = { | ||
run = "treefmt {staged_files}"; | ||
glob = "*"; | ||
}; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
book = { | ||
language = "en"; | ||
multilingual = false; | ||
src = "docs"; | ||
title = "Documentation"; | ||
}; | ||
build = { | ||
build-dir = "docs/book"; | ||
}; | ||
preprocessor = { | ||
kroki-preprocessor = { | ||
command = "mdbook-kroki-preprocessor"; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
formatter = { | ||
nix = { | ||
command = "alejandra"; | ||
includes = ["*.nix"]; | ||
}; | ||
prettier = { | ||
command = "prettier"; | ||
options = ["--plugin" "prettier-plugin-toml" "--write"]; | ||
includes = [ | ||
"*.css" | ||
"*.html" | ||
"*.js" | ||
"*.json" | ||
"*.jsx" | ||
"*.md" | ||
"*.mdx" | ||
"*.scss" | ||
"*.ts" | ||
"*.yaml" | ||
"*.toml" | ||
]; | ||
}; | ||
shell = { | ||
command = "shfmt"; | ||
options = ["-i" "2" "-s" "-w"]; | ||
includes = ["*.sh"]; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters