-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
83 lines (78 loc) · 2.34 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
{
description = "Bibliography";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = {
self,
flake-utils,
git-hooks,
nixpkgs,
}: let
supportedSystems = ["x86_64-linux"];
in
flake-utils.lib.eachSystem supportedSystems (system: let
pkgs = import nixpkgs {inherit system;};
in {
checks = {
pre-commit-check = git-hooks.lib.${system}.run {
src = ./.;
excludes = ["flake\.lock"];
hooks = with pkgs; {
check_docfiles = let
python = pkgs.python3.withPackages (ps: with ps; [pyyaml]);
in {
enable = true;
name = "check-docfiles";
entry = "${python}/bin/python3 ./scripts/check_docfiles.py";
files = "\.(yaml|bib)$";
language = "system";
pass_filenames = false;
always_run = true;
};
make_bib = {
enable = true;
name = "make-bibliography";
entry = "${pkgs.stdenv.shell} ./scripts/make-bib.sh";
files = "\.(yaml|bib)$";
language = "system";
pass_filenames = false;
};
validate_bib = {
enable = true;
name = "validate-bibliograhy";
entry = "${pkgs.biber}/bin/biber --tool -V ./bibliography.bib";
files = "bibliography.bib";
language = "system";
pass_filenames = false;
};
alejandra.enable = true;
commitizen.enable = true;
editorconfig-checker.enable = true;
prettier.enable = true;
statix.enable = true;
typos.enable = true;
};
};
};
devShells = {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
just
nodePackages.prettier
pandoc
pubs
texlive.combined.scheme-full
(python3.withPackages (ps: with ps; [pyyaml]))
];
inherit (self.checks.${system}.pre-commit-check) shellHook;
};
};
});
}