Skip to content

Commit c2f85d7

Browse files
committed
replace treefmt-nix with nixfmt-tree
1 parent 0327ef0 commit c2f85d7

File tree

2 files changed

+28
-138
lines changed

2 files changed

+28
-138
lines changed

flake.lock

Lines changed: 10 additions & 116 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,20 @@
44
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
55
inputs.pyproject-nix.url = "github:nix-community/pyproject.nix";
66
inputs.pyproject-nix.inputs.nixpkgs.follows = "nixpkgs";
7-
inputs.pyproject-nix.inputs.treefmt-nix.follows = "treefmt-nix";
87
inputs.flake-utils.url = "github:numtide/flake-utils";
9-
inputs.treefmt-nix.url = "github:numtide/treefmt-nix";
10-
inputs.treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
118

129
outputs =
1310
{
1411
self,
1512
nixpkgs,
1613
pyproject-nix,
1714
flake-utils,
18-
treefmt-nix,
1915
}:
2016
flake-utils.lib.eachDefaultSystem (
2117
system:
2218
let
2319
pkgs = nixpkgs.legacyPackages.${system};
2420
project = pyproject-nix.lib.project.loadPyproject { projectRoot = ./.; };
25-
treefmt = treefmt-nix.lib.evalModule pkgs {
26-
projectRootFile = "flake.nix";
27-
programs.mypy.enable = true;
28-
programs.mypy.directories."." = {
29-
modules = [
30-
"src/qbpm"
31-
"tests"
32-
];
33-
extraPythonPackages = self.packages.${system}.default.propagatedBuildInputs;
34-
};
35-
programs.ruff.check = true;
36-
programs.ruff.format = true;
37-
programs.nixfmt.enable = true;
38-
};
3921
python = pkgs.python3;
4022
projectPackage =
4123
args:
@@ -66,8 +48,8 @@
6648
apps.default = self.apps.${system}.qbpm;
6749

6850
devShells.default = pkgs.mkShell {
69-
inputsFrom = [ treefmt.config.build.devShell ];
70-
buildInputs = [
51+
packages = [
52+
self.formatter.${system}
7153
(projectEnv (
7254
ps: with ps; [
7355
pytest
@@ -78,8 +60,22 @@
7860
];
7961
};
8062

81-
formatter = treefmt.config.build.wrapper;
82-
checks.formatting = treefmt.config.build.check self;
63+
formatter = pkgs.nixfmt-tree.override {
64+
runtimeInputs = with pkgs; [ ruff ];
65+
settings = {
66+
on-unmatched = "info";
67+
tree-root-file = "flake.nix";
68+
formatter.ruff = {
69+
command = "ruff";
70+
options = [ "format" ];
71+
includes = [ "*.py" ];
72+
};
73+
formatter.nixfmt = {
74+
command = "nixfmt";
75+
includes = [ "*.nix" ];
76+
};
77+
};
78+
};
8379
}
8480
);
8581
}

0 commit comments

Comments
 (0)