chore: add treefmt
This commit is contained in:
parent
2f12878792
commit
08d011b4a5
3 changed files with 91 additions and 0 deletions
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1756128520,
|
||||||
|
"narHash": "sha256-R94HxJBi+RK1iCm8Y4Q9pdrHZl0GZoDPIaYwjxRNPh4=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "c53baa6685261e5253a1c355a1b322f82674a824",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
32
flake.nix
Normal file
32
flake.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{ nixpkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (nixpkgs) lib;
|
||||||
|
|
||||||
|
eachSystem = f: lib.genAttrs systems (s: f nixpkgs.legacyPackages.${s});
|
||||||
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
"x86_64-darwin"
|
||||||
|
"aarch64-darwin"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
formatter = eachSystem (
|
||||||
|
pkgs:
|
||||||
|
pkgs.treefmt.withConfig {
|
||||||
|
settings = lib.mkMerge [
|
||||||
|
./treefmt.nix
|
||||||
|
{ _module.args = { inherit pkgs; }; }
|
||||||
|
];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
32
treefmt.nix
Normal file
32
treefmt.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
tree-root-file = "treefmt.nix";
|
||||||
|
on-unmatched = "fatal";
|
||||||
|
|
||||||
|
excludes = [
|
||||||
|
"*.lock"
|
||||||
|
"*.md"
|
||||||
|
".gitignore"
|
||||||
|
"LICENSE"
|
||||||
|
];
|
||||||
|
|
||||||
|
formatter.nixfmt = {
|
||||||
|
command = lib.getExe pkgs.nixfmt;
|
||||||
|
includes = [ "*.nix" ];
|
||||||
|
options = [ "--strict" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
formatter.prettier = {
|
||||||
|
command = lib.getExe pkgs.nodePackages.prettier;
|
||||||
|
includes = [
|
||||||
|
"*.js"
|
||||||
|
"*.yml"
|
||||||
|
];
|
||||||
|
options = [
|
||||||
|
"--write"
|
||||||
|
"--print-width=120"
|
||||||
|
"--arrow-parens=avoid"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue