feat: Add treefmt
This commit is contained in:
parent
c403a8151b
commit
ed0b08f81e
35
flake.lock
35
flake.lock
|
@ -86,11 +86,28 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1708475490,
|
||||
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"snowfall-lib": "snowfall-lib",
|
||||
"treefmt-nix": "treefmt-nix",
|
||||
"wiki": "wiki"
|
||||
}
|
||||
},
|
||||
|
@ -146,6 +163,24 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715940852,
|
||||
"narHash": "sha256-wJqHMg/K6X3JGAE9YLM0LsuKrKb4XiBeVaoeMNlReZg=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "2fba33a182602b9d49f0b2440513e5ee091d838b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"wiki": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
inputs.treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
|
||||
outputs =
|
||||
inputs:
|
||||
inputs.snowfall-lib.mkFlake {
|
||||
|
@ -26,6 +28,11 @@
|
|||
namespace = "auxolotl--docs-site";
|
||||
};
|
||||
|
||||
outputs-builder = channels: { formatter = channels.nixpkgs.nixfmt-rfc-style; };
|
||||
outputs-builder = channels: let
|
||||
treefmt = inputs.treefmt-nix.lib.evalModule channels.nixpkgs ./treefmt.nix;
|
||||
in {
|
||||
formatter = treefmt.config.build.wrapper;
|
||||
checks.formatting = treefmt.config.build.check inputs.self;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
28
treefmt.nix
Normal file
28
treefmt.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
# treefmt.nix
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
# Used to find the project root
|
||||
projectRootFile = "flake.nix";
|
||||
|
||||
# go
|
||||
programs.gofmt.enable = true;
|
||||
|
||||
# js/ts
|
||||
programs.prettier.enable = true;
|
||||
|
||||
# markdown
|
||||
programs.mdformat.enable = true;
|
||||
|
||||
# nix
|
||||
programs.nixfmt-rfc-style.enable = true;
|
||||
programs.statix.enable = true;
|
||||
|
||||
# python
|
||||
programs.black.enable = true;
|
||||
|
||||
# rust
|
||||
programs.rustfmt.enable = true;
|
||||
|
||||
# swift
|
||||
programs.swift-format.enable = true;
|
||||
}
|
Loading…
Reference in a new issue