Skip to content

Commit a3fbc0b

Browse files
committed
add treefmt-nix
1 parent 1176948 commit a3fbc0b

File tree

2 files changed

+45
-3
lines changed

2 files changed

+45
-3
lines changed

flake.lock

Lines changed: 22 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,31 @@
55
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
66
flake-parts.url = "github:hercules-ci/flake-parts";
77
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
8+
treefmt-nix.url = "github:numtide/treefmt-nix";
9+
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
810
};
911

10-
outputs = inputs@{ flake-parts, ... }:
12+
outputs = inputs@{ flake-parts, treefmt-nix, ... }:
1113
flake-parts.lib.mkFlake { inherit inputs; } ({ lib, ... }: {
14+
imports = [
15+
treefmt-nix.flakeModule
16+
];
1217
systems = lib.systems.flakeExposed;
13-
perSystem = { pkgs, ... }: {
18+
perSystem = { pkgs, config, ... }: {
19+
treefmt = {
20+
projectRootFile = "flake.nix";
21+
programs = {
22+
ruff.format = true;
23+
ruff.check = true;
24+
mypy.enable = true;
25+
mypy.directories = {
26+
"." = {
27+
modules = [ "mpd" ];
28+
};
29+
};
30+
};
31+
};
32+
1433
devShells.default = pkgs.mkShell {
1534
packages = with pkgs; [
1635
bashInteractive
@@ -22,6 +41,8 @@
2241
pypy3
2342
twine
2443
mypy
44+
ruff
45+
config.treefmt.build.wrapper
2546
];
2647
};
2748
};

0 commit comments

Comments
 (0)