flake.nix: Add and configure treefmt-nix for nix fmt
This commit is contained in:
parent
b81e8f00bb
commit
a033432bb8
2 changed files with 37 additions and 3 deletions
23
flake.lock
generated
23
flake.lock
generated
|
|
@ -116,7 +116,28 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"git-hooks-nix": "git-hooks-nix",
|
"git-hooks-nix": "git-hooks-nix",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"treefmt-nix": "treefmt-nix"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"treefmt-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1733440889,
|
||||||
|
"narHash": "sha256-qKL3vjO+IXFQ0nTinFDqNq/sbbnnS5bMI1y0xX215fU=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"rev": "50862ba6a8a0255b87377b9d2d4565e96f29b410",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "treefmt-nix",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
15
flake.nix
15
flake.nix
|
|
@ -5,6 +5,8 @@
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
||||||
|
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||||
|
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
git-hooks-nix.url = "github:cachix/git-hooks.nix";
|
git-hooks-nix.url = "github:cachix/git-hooks.nix";
|
||||||
git-hooks-nix.inputs.nixpkgs.follows = "nixpkgs";
|
git-hooks-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
@ -21,6 +23,7 @@
|
||||||
"aarch64-linux"
|
"aarch64-linux"
|
||||||
];
|
];
|
||||||
imports = [
|
imports = [
|
||||||
|
inputs.treefmt-nix.flakeModule
|
||||||
inputs.git-hooks-nix.flakeModule
|
inputs.git-hooks-nix.flakeModule
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -43,7 +46,7 @@
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
alejandra
|
self'.formatter.outPath # Add all formatters to environment
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
${config.pre-commit.installationScript}
|
${config.pre-commit.installationScript}
|
||||||
|
|
@ -51,8 +54,18 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
pre-commit.settings.hooks = {
|
pre-commit.settings.hooks = {
|
||||||
|
treefmt.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
treefmt = {
|
||||||
|
programs = {
|
||||||
alejandra.enable = true;
|
alejandra.enable = true;
|
||||||
};
|
};
|
||||||
|
settings.global.excludes = [
|
||||||
|
".envrc"
|
||||||
|
"*.sieve"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
flake.flakeModules = rec {
|
flake.flakeModules = rec {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue