feat: switch to nixfmt and add pre-commit hook

This commit is contained in:
2026-02-20 18:00:58 +01:00
parent 3dd048ebe3
commit fb515d205b
3 changed files with 24 additions and 11 deletions

6
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/nixos/nixfmt
rev: v1.2.0
hooks:
- id: nixfmt-nix
args: [--, --check]

View File

@@ -94,11 +94,22 @@
lib = nixpkgs.lib; lib = nixpkgs.lib;
} { }; } { };
} }
// flake-utils.lib.eachDefaultSystem (system: { // flake-utils.lib.eachDefaultSystem (
packages = import ./packages { system:
inherit my-lib; let
lib = nixpkgs.lib; pkgs = nixpkgs.legacyPackages.${system};
} (inputs // { inherit system; }); in
formatter = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style; {
}); packages = import ./packages {
inherit my-lib;
lib = nixpkgs.lib;
} (inputs // { inherit system; });
formatter = pkgs.nixfmt-tree;
devShells.default = pkgs.mkShell {
packages = [ pkgs.pre-commit ];
};
}
);
} }

View File

@@ -1,4 +0,0 @@
[formatter.nix]
command = "nix"
options = ["fmt"]
includes = [ "*.nix" ]