switch to treefmt module

This commit is contained in:
Bryton Hall 2023-07-06 22:36:37 -04:00
parent 319912f5f2
commit c70834ccb9
4 changed files with 66 additions and 48 deletions

View file

@ -46,7 +46,7 @@ details {
}
&[open] summary:before {
@include arrow(45deg);
@include arrow(45deg);
}
.table-container {
@ -59,7 +59,8 @@ details {
width: calc(100% - 1px);
}
table, tbody {
table,
tbody {
// fill entire width
margin: 0 !important;
@ -101,13 +102,13 @@ aside.book-menu span {
.source {
position: relative;
.filename {
position: absolute;
right: 0px;
margin: 0;
line-height: 0;
font-size: 0.8rem;
background-color: transparent;
color: #d8dee9;
position: absolute;
right: 0px;
margin: 0;
line-height: 0;
font-size: 0.8rem;
background-color: transparent;
color: #d8dee9;
}
}
@ -115,4 +116,4 @@ aside.book-menu span {
.listing {
position: absolute;
bottom: 10px;
}
}

37
flake.lock generated
View file

@ -50,11 +50,28 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1680945546,
"narHash": "sha256-8FuaH5t/aVi/pR1XxnF0qi4WwMYC+YxlfdsA0V+TEuQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d9f759f2ea8d265d974a6e1259bd510ac5844c5d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"treefmt": "treefmt"
}
},
"systems": {
@ -71,6 +88,24 @@
"repo": "default",
"type": "github"
}
},
"treefmt": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1688026376,
"narHash": "sha256-qJmkr9BWDpqblk4E9/rCsAEl39y2n4Ycw6KRopvpUcY=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "df3f32b0cc253dfc7009b7317e8f0e7ccd70b1cf",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",

View file

@ -3,6 +3,7 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
treefmt.url = "github:numtide/treefmt-nix";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
@ -63,14 +64,6 @@
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
# formatters
alejandra
black
nodePackages.prettier
nodePackages.prettier-plugin-toml
shfmt
treefmt
# extra tools
dive
fd
@ -91,7 +84,24 @@
'';
};
formatter = pkgs.treefmt;
formatter =
(inputs.treefmt.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
black.enable = true;
prettier.enable = true;
shfmt.enable = true;
};
settings.global.excludes = [
"docs/themes/*"
"docs/layouts/*"
"modules/generated/*"
];
})
.config
.build
.wrapper;
apps = {
docs = inputs.flake-utils.lib.mkApp {

View file

@ -1,28 +0,0 @@
[global]
excludes = ["./docs/themes/*"]
[formatter.nix]
command = "alejandra"
includes = ["*.nix"]
excludes = ["./modules/generated/*"]
[formatter.prettier]
command = "prettier"
options = ["--plugin", "prettier-plugin-toml", "--write"]
includes = ["*.md", "*.yaml", "*.toml", "*.json"]
excludes = []
[formatter.black]
command = "black"
includes = ["*.py"]
[formatter.shell]
command = "shfmt"
options = [
"-i",
"2", # indent 2
"-s", # simplify the code
"-w", # write back to the file
]
includes = ["*.sh", "*.bash"]