flake: use treefmt-nix
This commit is contained in:
parent
79fa35d000
commit
6b169db906
3 changed files with 60 additions and 4 deletions
28
flake.lock
28
flake.lock
|
@ -2,7 +2,9 @@
|
|||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
"systems": [
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705309234,
|
||||
|
@ -37,7 +39,9 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
|
@ -54,6 +58,26 @@
|
|||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709911575,
|
||||
"narHash": "sha256-yC2iOKe0BSZAeXLNPXPrsGn5BwUTYYZESKb+OblLnXY=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "9c57261c71871d2208a6dd4394774cca226c6dbc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
19
flake.nix
19
flake.nix
|
@ -3,13 +3,25 @@
|
|||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
flake-utils = {
|
||||
url = "github:numtide/flake-utils";
|
||||
inputs.systems.follows = "systems";
|
||||
};
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
### De-dupe flake dependencies
|
||||
systems.url = "github:nix-systems/default";
|
||||
};
|
||||
|
||||
outputs = inputs:
|
||||
inputs.flake-utils.lib.eachDefaultSystem (system: let
|
||||
inherit (inputs.nixpkgs) lib;
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
||||
runtimeDeps = with pkgs; [
|
||||
# mason / tree-sitter
|
||||
gcc
|
||||
|
@ -33,7 +45,10 @@
|
|||
// {wrapperArgs = ["--prefix" "PATH" ":" "${lib.makeBinPath runtimeDeps}"];});
|
||||
|
||||
### nix fmt
|
||||
formatter = pkgs.alejandra;
|
||||
formatter = treefmtEval.config.build.wrapper;
|
||||
|
||||
### nix flake check
|
||||
checks = {formatting = treefmtEval.config.build.check inputs.self;};
|
||||
|
||||
### nix develop
|
||||
devShells.default = pkgs.mkShell {
|
||||
|
|
17
treefmt.nix
Normal file
17
treefmt.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
projectRootFile = "flake.nix";
|
||||
|
||||
### nix
|
||||
programs.deadnix.enable = true;
|
||||
programs.statix.enable = true;
|
||||
programs.alejandra.enable = true;
|
||||
|
||||
### lua
|
||||
programs.stylua.enable = true;
|
||||
|
||||
### toml
|
||||
programs.taplo.enable = true;
|
||||
|
||||
### misc
|
||||
programs.prettier.enable = true;
|
||||
}
|
Loading…
Reference in a new issue