|
4 | 4 | inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
5 | 5 | inputs.pyproject-nix.url = "github:nix-community/pyproject.nix";
|
6 | 6 | inputs.pyproject-nix.inputs.nixpkgs.follows = "nixpkgs";
|
7 |
| - inputs.pyproject-nix.inputs.treefmt-nix.follows = "treefmt-nix"; |
8 | 7 | 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"; |
11 | 8 |
|
12 | 9 | outputs =
|
13 | 10 | {
|
14 | 11 | self,
|
15 | 12 | nixpkgs,
|
16 | 13 | pyproject-nix,
|
17 | 14 | flake-utils,
|
18 |
| - treefmt-nix, |
19 | 15 | }:
|
20 | 16 | flake-utils.lib.eachDefaultSystem (
|
21 | 17 | system:
|
22 | 18 | let
|
23 | 19 | pkgs = nixpkgs.legacyPackages.${system};
|
24 | 20 | 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 |
| - }; |
39 | 21 | python = pkgs.python3;
|
40 | 22 | projectPackage =
|
41 | 23 | args:
|
|
66 | 48 | apps.default = self.apps.${system}.qbpm;
|
67 | 49 |
|
68 | 50 | devShells.default = pkgs.mkShell {
|
69 |
| - inputsFrom = [ treefmt.config.build.devShell ]; |
70 |
| - buildInputs = [ |
| 51 | + packages = [ |
| 52 | + self.formatter.${system} |
71 | 53 | (projectEnv (
|
72 | 54 | ps: with ps; [
|
73 | 55 | pytest
|
|
78 | 60 | ];
|
79 | 61 | };
|
80 | 62 |
|
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 | + }; |
83 | 79 | }
|
84 | 80 | );
|
85 | 81 | }
|
0 commit comments