mirror of
https://gitlab.com/simple-nixos-mailserver/nixos-mailserver.git
synced 2025-05-04 17:50:51 +05:00
flake.nix: configure pre-commit
This commit is contained in:
parent
9a5838f575
commit
72a1dcb355
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
result
|
result
|
||||||
|
.pre-commit-config.yaml
|
||||||
|
60
flake.lock
generated
60
flake.lock
generated
@ -32,6 +32,65 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-compat_2": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1696426674,
|
||||||
|
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "edolstra",
|
||||||
|
"repo": "flake-compat",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"git-hooks": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat_2",
|
||||||
|
"gitignore": "gitignore",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1742649964,
|
||||||
|
"narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=",
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "git-hooks.nix",
|
||||||
|
"rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "cachix",
|
||||||
|
"repo": "git-hooks.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"gitignore": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"git-hooks",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1709087332,
|
||||||
|
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "gitignore.nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1745234285,
|
"lastModified": 1745234285,
|
||||||
@ -66,6 +125,7 @@
|
|||||||
"inputs": {
|
"inputs": {
|
||||||
"blobs": "blobs",
|
"blobs": "blobs",
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
|
"git-hooks": "git-hooks",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs-24_11": "nixpkgs-24_11"
|
"nixpkgs-24_11": "nixpkgs-24_11"
|
||||||
}
|
}
|
||||||
|
31
flake.nix
31
flake.nix
@ -6,6 +6,10 @@
|
|||||||
url = "github:edolstra/flake-compat";
|
url = "github:edolstra/flake-compat";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
git-hooks = {
|
||||||
|
url = "github:cachix/git-hooks.nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
nixpkgs.url = "flake:nixpkgs/nixos-unstable";
|
nixpkgs.url = "flake:nixpkgs/nixos-unstable";
|
||||||
nixpkgs-24_11.url = "flake:nixpkgs/nixos-24.11";
|
nixpkgs-24_11.url = "flake:nixpkgs/nixos-24.11";
|
||||||
blobs = {
|
blobs = {
|
||||||
@ -14,7 +18,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, blobs, nixpkgs, nixpkgs-24_11, ... }: let
|
outputs = { self, blobs, git-hooks, nixpkgs, nixpkgs-24_11, ... }: let
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
pkgs = nixpkgs.legacyPackages.${system};
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
@ -112,7 +116,27 @@
|
|||||||
hydraJobs.${system} = allTests // {
|
hydraJobs.${system} = allTests // {
|
||||||
inherit documentation;
|
inherit documentation;
|
||||||
};
|
};
|
||||||
checks.${system} = allTests;
|
checks.${system} = allTests // {
|
||||||
|
pre-commit = git-hooks.lib.${system}.run {
|
||||||
|
src = ./.;
|
||||||
|
hooks = {
|
||||||
|
# docs
|
||||||
|
markdownlint.enable = true;
|
||||||
|
|
||||||
|
# nix
|
||||||
|
nixfmt-rfc-style.enable = true;
|
||||||
|
statix.enable = true;
|
||||||
|
|
||||||
|
# python
|
||||||
|
pyright.enable = true;
|
||||||
|
ruff.enable = true;
|
||||||
|
ruff-format.enable = true;
|
||||||
|
|
||||||
|
# scripts
|
||||||
|
shellcheck.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
packages.${system} = {
|
packages.${system} = {
|
||||||
inherit optionsDoc documentation;
|
inherit optionsDoc documentation;
|
||||||
};
|
};
|
||||||
@ -120,7 +144,8 @@
|
|||||||
inputsFrom = [ documentation ];
|
inputsFrom = [ documentation ];
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
clamav
|
clamav
|
||||||
];
|
] ++ self.checks.${system}.pre-commit.enabledPackages;
|
||||||
|
shellHook = self.checks.${system}.pre-commit.shellHook;
|
||||||
};
|
};
|
||||||
devShell.${system} = self.devShells.${system}.default; # compatibility
|
devShell.${system} = self.devShells.${system}.default; # compatibility
|
||||||
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-tree; # TODO: migrate to stable with 25.05
|
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-tree; # TODO: migrate to stable with 25.05
|
||||||
|
Loading…
x
Reference in New Issue
Block a user