-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
93 lines (88 loc) · 2.5 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{
description = "Sandbox";
outputs = inputs @ {
self,
flake-utils,
nixpkgs,
pre-commit-hooks,
...
}: let
supportedSystems = ["x86_64-linux"];
in
{
templates = {
flake = {
path = ./.templates/flake;
description = "Sandbox with flake";
};
shell = {
path = ./.templates/shell;
description = "Sandbox with only a Nix shell";
};
};
}
// flake-utils.lib.eachSystem supportedSystems (system: let
pkgs = import nixpkgs {inherit system;};
in {
checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
make_readme = {
enable = true;
name = "make-readme";
entry = "${pkgs.python3}/bin/python make_readme.py";
files = ".*\\.(nix|py|md)";
language = "system";
pass_filenames = false;
};
make_readme_gh = {
enable = true;
name = "make-readme-gh";
entry = "${pkgs.stdenv.shell} .github/make-readme.sh";
files = ".*\\.(md|html)";
language = "system";
pass_filenames = false;
};
alejandra.enable = true;
commitizen.enable = true;
checkmake.enable = true;
clang-format.enable = true;
deadnix.enable = true;
editorconfig-checker.enable = true;
gofmt.enable = true;
markdownlint.enable = true;
nil.enable = true;
prettier.enable = true;
ruff.enable = true;
shfmt.enable = true;
shellcheck.enable = true;
statix.enable = true;
taplo.enable = true;
typos.enable = true;
typstfmt.enable = true;
yamllint.enable = true;
};
};
};
devShells = {
default = pkgs.mkShell {
propagatedBuildInputs = with pkgs; [
just
];
shellHook = ''
${self.checks.${system}.pre-commit-check.shellHook}
export NIX_PATH="nixpkgs=${inputs.nixpkgs}"
'';
};
};
});
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
pre-commit-hooks = {
url = "github:NorfairKing/nix-pre-commit-hooks/typstfmt";
inputs.nixpkgs.follows = "nixpkgs";
};
};
}