forked from clan/clan-core
chore: add module for formatting
This will export a check for formatting and makes `nix fmt` use treefmt
This commit is contained in:
parent
af94d11b1a
commit
4036df90d2
15
flake-parts/formatting.nix
Normal file
15
flake-parts/formatting.nix
Normal file
@ -0,0 +1,15 @@
|
||||
{self, inputs, ...}: {
|
||||
imports = [
|
||||
inputs.treefmt-nix.flakeModule
|
||||
];
|
||||
perSystem = {
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
treefmt.projectRootFile = "flake.nix";
|
||||
treefmt.flakeCheck = true;
|
||||
treefmt.flakeFormatter = true;
|
||||
treefmt.programs.alejandra.enable = true;
|
||||
treefmt.programs.shellcheck.enable = true;
|
||||
};
|
||||
}
|
4
flake-parts/pre-commit.nix
Normal file
4
flake-parts/pre-commit.nix
Normal file
@ -0,0 +1,4 @@
|
||||
{ self, ... }: {
|
||||
pre-commit.settings.hooks.alejandra.enable = true;
|
||||
pre-commit.settings.hooks.shellcheck.enable = true;
|
||||
}
|
23
flake.lock
23
flake.lock
@ -76,7 +76,28 @@
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixos-generators": "nixos-generators",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689070229,
|
||||
"narHash": "sha256-99VU2FTkEdO3/1Qr78fHWWlN5GaOGLaXDi26PNiUf+I=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "3c54278bf7b8642eba174a22ca02d5552c21dc0b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -7,6 +7,8 @@
|
||||
nixos-generators.inputs.nixpkgs.follows = "nixpkgs";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = inputs@{ flake-parts, ... }:
|
||||
@ -14,6 +16,7 @@
|
||||
systems = lib.systems.flakeExposed;
|
||||
imports = [
|
||||
./flake-parts/packages.nix
|
||||
./flake-parts/formatting.nix
|
||||
];
|
||||
flake = {
|
||||
nixosConfigurations.installer = lib.nixosSystem {
|
||||
|
Loading…
Reference in New Issue
Block a user