flake: add treefmt-nix
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
parent
8e74a21b19
commit
284d4a2c33
23
flake.lock
23
flake.lock
|
@ -58,7 +58,8 @@
|
|||
"crane": "crane",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
"rust-overlay": "rust-overlay",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
|
@ -95,6 +96,26 @@
|
|||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1723808491,
|
||||
"narHash": "sha256-rhis3qNuGmJmYC/okT7Dkc4M8CeUuRCSvW6kC2f3hBc=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "1d07739554fdc4f8481068f1b11d6ab4c1a4167a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
24
flake.nix
24
flake.nix
|
@ -4,6 +4,10 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
crane = {
|
||||
url = "github:ipetkov/crane";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -14,7 +18,8 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, crane, rust-overlay, ... }:
|
||||
outputs =
|
||||
{ self, nixpkgs, flake-utils, treefmt-nix, crane, rust-overlay, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs {
|
||||
|
@ -23,6 +28,20 @@
|
|||
};
|
||||
inherit (pkgs) lib;
|
||||
|
||||
treefmt = treefmt-nix.lib.evalModule pkgs {
|
||||
projectRootFile = "flake.nix";
|
||||
programs = {
|
||||
deadnix.enable = true;
|
||||
nixfmt = {
|
||||
enable = true;
|
||||
package = pkgs.nixfmt-classic;
|
||||
};
|
||||
prettier.enable = true;
|
||||
statix.enable = true;
|
||||
taplo.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
||||
extensions = [ "rust-analyzer" ];
|
||||
};
|
||||
|
@ -63,6 +82,7 @@
|
|||
checks = {
|
||||
inherit bwtui;
|
||||
default = bwtui;
|
||||
formatting = treefmt.config.build.check self;
|
||||
bwtui-clippy = craneLib.cargoClippy commonArgsWithArtifacts // {
|
||||
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
||||
};
|
||||
|
@ -73,6 +93,8 @@
|
|||
bwtui-coverage = craneLib.cargoTarpaulin commonArgsWithArtifacts;
|
||||
};
|
||||
|
||||
formatter = treefmt.config.build.wrapper;
|
||||
|
||||
packages = rec {
|
||||
inherit bwtui;
|
||||
default = bwtui;
|
||||
|
|
Loading…
Reference in a new issue