style: Define formatter in flake to allow nix fmt

Noticed this was an option to codify the agreed style/pattern
auto-normalise discussed in [#143]

[#143]: https://github.com/nix-community/disko/pull/143
This commit is contained in:
Chris Scutcher 2023-02-07 15:51:33 +00:00
parent 4ba8181319
commit a393654c3b
No known key found for this signature in database
GPG key ID: 19C0BED130CD39CE

View file

@ -57,5 +57,22 @@
'';
in
nixosTests // { inherit shellcheck; });
formatter = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.writeShellApplication {
name = "normalise_nix";
runtimeInputs = with pkgs; [
nixpkgs-fmt
statix
];
text = ''
set -o xtrace
nixpkgs-fmt "$@"
statix fix "$@"
'';
}
);
};
}