enable more formatters

This commit is contained in:
Jörg Thalheim 2024-07-06 11:13:17 +02:00 committed by mergify[bot]
parent eb6f4a74c3
commit ffc543701b
2 changed files with 65 additions and 25 deletions

View File

@ -24,7 +24,6 @@
systems = [
"aarch64-linux"
"x86_64-linux"
"riscv64-linux"
"x86_64-darwin"
"aarch64-darwin"
@ -34,32 +33,9 @@
./targets/flake-module.nix
./modules/flake-module.nix
./checks/flake-module.nix
./formatter.nix
];
perSystem = { config, self', system, pkgs, ... }: {
treefmt = {
projectRootFile = "flake.nix";
programs.hclfmt.enable = true;
programs.nixpkgs-fmt.enable = true;
};
packages.default =
pkgs.mkShell {
packages =
let
convert2Tofu = provider: provider.override (prev: {
homepage = builtins.replaceStrings [ "registry.terraform.io/providers" ] [ "registry.opentofu.org" ] prev.homepage;
});
in
[
pkgs.bashInteractive
pkgs.sops
(pkgs.opentofu.withPlugins (p: builtins.map convert2Tofu [
p.hcloud
p.null
p.external
p.local
]))
];
};
checks =
let

64
formatter.nix Normal file
View File

@ -0,0 +1,64 @@
{
perSystem =
{ config
, self'
, system
, pkgs
, ...
}:
{
treefmt = {
projectRootFile = "flake.nix";
settings.global.excludes = [
"*/nixos-vars.json"
"*/secrets.yaml"
"*.lock"
".gitignore"
"modules/nixos-wiki/favicon.ico"
"modules/nixos-wiki/nixos.png"
"modules/nixos-wiki/robots.txt"
"oauth-permissions.png"
"targets/nixos-wiki.nixos.org/secrets/*"
];
programs.hclfmt.enable = true;
programs.nixpkgs-fmt.enable = true;
programs.ruff.format = true;
programs.ruff.check = true;
programs.shfmt.enable = true;
programs.yamlfmt.enable = true;
settings.formatter.shfmt.includes = [
"*.envrc"
"*.envrc.private-template"
];
programs.shellcheck.enable = true;
programs.deno.enable = true;
};
packages.default = pkgs.mkShell {
packages =
let
convert2Tofu =
provider:
provider.override (prev: {
homepage = builtins.replaceStrings [ "registry.terraform.io/providers" ] [
"registry.opentofu.org"
]
prev.homepage;
});
in
[
pkgs.bashInteractive
pkgs.sops
(pkgs.opentofu.withPlugins (
p:
builtins.map convert2Tofu [
p.hcloud
p.null
p.external
p.local
]
))
];
};
};
}