forked from lix-project/nix-eval-jobs
Add treefmt
And use it in place of editorconfig/nixpkgs-fmt checks
This commit is contained in:
parent
9482b5ab3e
commit
516fdc8f6c
|
@ -1,24 +0,0 @@
|
|||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{cc,hh,hpp,pl,pm,sh,t}]
|
||||
indent_style = space
|
||||
intend_size = 4
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
[*.nix]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# Match diffs, avoid to trim trailing whitespace
|
||||
[*.{diff,patch}]
|
||||
trim_trailing_whitespace = false
|
30
flake.nix
30
flake.nix
|
@ -8,6 +8,7 @@
|
|||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
inherit (pkgs) stdenv;
|
||||
drvArgs = { srcDir = self; };
|
||||
in
|
||||
rec {
|
||||
|
@ -26,25 +27,18 @@
|
|||
in
|
||||
{
|
||||
|
||||
editorconfig = pkgs.runCommand "editorconfig-check"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
pkgs.editorconfig-checker
|
||||
];
|
||||
} ''
|
||||
editorconfig-checker ${self}
|
||||
touch $out
|
||||
'';
|
||||
treefmt = stdenv.mkDerivation {
|
||||
name = "treefmt-check";
|
||||
src = self;
|
||||
nativeBuildInputs = devShells.default.nativeBuildInputs;
|
||||
dontConfigure = true;
|
||||
|
||||
nixpkgs-fmt = pkgs.runCommand "fmt-check"
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
pkgs.nixpkgs-fmt
|
||||
];
|
||||
} ''
|
||||
nixpkgs-fmt --check .
|
||||
touch $out
|
||||
'';
|
||||
buildPhase = ''
|
||||
env HOME=$(mktemp -d) treefmt --fail-on-change
|
||||
'';
|
||||
|
||||
installPhase = "touch $out";
|
||||
};
|
||||
|
||||
build = mkVariant pkgs.nix;
|
||||
build-unstable = mkVariant pkgs.nixUnstable;
|
||||
|
|
|
@ -26,8 +26,7 @@ in
|
|||
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [
|
||||
|
||||
pkgs.editorconfig-checker
|
||||
|
||||
pkgs.treefmt
|
||||
pkgs.nixpkgs-fmt
|
||||
|
||||
(pkgs.python3.withPackages (ps: [
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
pkgs ? import (builtins.getFlake (toString ./.)).inputs.nixpkgs { }
|
||||
, system ? pkgs.system
|
||||
{ pkgs ? import (builtins.getFlake (toString ./.)).inputs.nixpkgs { }
|
||||
, system ? pkgs.system
|
||||
}:
|
||||
|
||||
{
|
||||
|
|
3
treefmt.toml
Normal file
3
treefmt.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
[formatter.nix]
|
||||
command = "nixpkgs-fmt"
|
||||
includes = ["*.nix"]
|
Loading…
Reference in a new issue