forked from mirrors_public/oddlama_nix-config
feat: add treefmt and switch to nixfmt-rfc-style
This commit is contained in:
parent
5cea27f592
commit
deca311c68
3 changed files with 111 additions and 90 deletions
21
flake.lock
generated
21
flake.lock
generated
|
@ -2071,6 +2071,7 @@
|
|||
"nixvim": "nixvim",
|
||||
"pre-commit-hooks": "pre-commit-hooks_6",
|
||||
"stylix": "stylix",
|
||||
"treefmt-nix": "treefmt-nix_5",
|
||||
"whisper-overlay": "whisper-overlay",
|
||||
"wired-notify": "wired-notify"
|
||||
}
|
||||
|
@ -2511,6 +2512,26 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix_5": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1732292307,
|
||||
"narHash": "sha256-5WSng844vXt8uytT5djmqBCkopyle6ciFgteuA9bJpw=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "705df92694af7093dfbb27109ce16d828a79155f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
|
|
@ -95,6 +95,11 @@
|
|||
inputs.home-manager.follows = "home-manager";
|
||||
};
|
||||
|
||||
treefmt-nix = {
|
||||
url = "github:numtide/treefmt-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
whisper-overlay = {
|
||||
url = "github:oddlama/whisper-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -106,7 +111,8 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = inputs:
|
||||
outputs =
|
||||
inputs:
|
||||
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [
|
||||
./nix/agenix-rekey.nix
|
||||
|
|
|
@ -1,25 +1,27 @@
|
|||
{inputs, ...}: {
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.devshell.flakeModule
|
||||
inputs.pre-commit-hooks.flakeModule
|
||||
inputs.treefmt-nix.flakeModule
|
||||
];
|
||||
|
||||
perSystem = {
|
||||
perSystem =
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
pre-commit.settings.hooks = {
|
||||
alejandra.enable = true;
|
||||
}:
|
||||
{
|
||||
pre-commit.settings.hooks.treefmt.enable = true;
|
||||
treefmt = {
|
||||
projectRootFile = "flake.nix";
|
||||
programs = {
|
||||
deadnix.enable = true;
|
||||
statix.enable = true;
|
||||
#gitleaks = {
|
||||
# enable = true;
|
||||
# name = "gitleaks";
|
||||
# entry = "${pkgs.gitleaks}/bin/gitleaks protect --verbose --redact --staged";
|
||||
# language = "system";
|
||||
# pass_filenames = false;
|
||||
#};
|
||||
nixfmt.enable = true;
|
||||
rustfmt.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
devshells.default = {
|
||||
|
@ -28,22 +30,14 @@
|
|||
];
|
||||
|
||||
commands = [
|
||||
{
|
||||
package = config.treefmt.build.wrapper;
|
||||
help = "Format all files";
|
||||
}
|
||||
{
|
||||
package = pkgs.deploy;
|
||||
help = "Build and deploy this nix config to nodes";
|
||||
}
|
||||
{
|
||||
package = pkgs.alejandra;
|
||||
help = "Format nix code";
|
||||
}
|
||||
{
|
||||
package = pkgs.statix;
|
||||
help = "Lint nix code";
|
||||
}
|
||||
{
|
||||
package = pkgs.deadnix;
|
||||
help = "Find unused expressions in nix code";
|
||||
}
|
||||
{
|
||||
package = pkgs.nix-tree;
|
||||
help = "Interactively browse dependency graphs of Nix derivations";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue