Use treefmt-nix and Alejandro

This commit is contained in:
Pim Kunis 2024-10-28 14:11:40 +01:00
parent 2352a1a917
commit eed797fb13
3 changed files with 21 additions and 3 deletions

View file

@ -17,6 +17,12 @@
deploy-rs.url = "github:serokell/deploy-rs"; deploy-rs.url = "github:serokell/deploy-rs";
nixos-hardware.url = "github:NixOS/nixos-hardware/master"; nixos-hardware.url = "github:NixOS/nixos-hardware/master";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
treefmt-nix.url = "github:numtide/treefmt-nix";
pre-commit-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
disko = { disko = {
url = "github:nix-community/disko"; url = "github:nix-community/disko";
@ -58,7 +64,6 @@
./shell.nix ./shell.nix
./utils ./utils
./machines ./machines
] // (flake-utils.lib.eachDefaultSystem (system: { ./formatter.nix
formatter = nixpkgs.legacyPackages.${system}.nixfmt; ];
}));
} }

9
formatter.nix Normal file
View file

@ -0,0 +1,9 @@
{ nixpkgs, treefmt-nix, flake-utils, ...}: flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in
{
formatter = treefmtEval.config.build.wrapper;
}
)

4
treefmt.nix Normal file
View file

@ -0,0 +1,4 @@
{...}: {
projectRootFile = "flake.nix";
programs.alejandra.enable = true;
}