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",
|
"crane": "crane",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay",
|
||||||
|
"treefmt-nix": "treefmt-nix"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
|
@ -95,6 +96,26 @@
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"type": "github"
|
"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",
|
"root": "root",
|
||||||
|
|
24
flake.nix
24
flake.nix
|
@ -4,6 +4,10 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
treefmt-nix = {
|
||||||
|
url = "github:numtide/treefmt-nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
crane = {
|
crane = {
|
||||||
url = "github:ipetkov/crane";
|
url = "github:ipetkov/crane";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
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:
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
|
@ -23,6 +28,20 @@
|
||||||
};
|
};
|
||||||
inherit (pkgs) lib;
|
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 {
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
||||||
extensions = [ "rust-analyzer" ];
|
extensions = [ "rust-analyzer" ];
|
||||||
};
|
};
|
||||||
|
@ -63,6 +82,7 @@
|
||||||
checks = {
|
checks = {
|
||||||
inherit bwtui;
|
inherit bwtui;
|
||||||
default = bwtui;
|
default = bwtui;
|
||||||
|
formatting = treefmt.config.build.check self;
|
||||||
bwtui-clippy = craneLib.cargoClippy commonArgsWithArtifacts // {
|
bwtui-clippy = craneLib.cargoClippy commonArgsWithArtifacts // {
|
||||||
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
|
||||||
};
|
};
|
||||||
|
@ -73,6 +93,8 @@
|
||||||
bwtui-coverage = craneLib.cargoTarpaulin commonArgsWithArtifacts;
|
bwtui-coverage = craneLib.cargoTarpaulin commonArgsWithArtifacts;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
formatter = treefmt.config.build.wrapper;
|
||||||
|
|
||||||
packages = rec {
|
packages = rec {
|
||||||
inherit bwtui;
|
inherit bwtui;
|
||||||
default = bwtui;
|
default = bwtui;
|
||||||
|
|
Loading…
Reference in a new issue