generated from nix-community/nur-packages-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci-devshell.nix
95 lines (92 loc) · 2.32 KB
/
ci-devshell.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
94
95
{ self
, pkgs
, system ? builtins.currentSystem
, nix-pre-commit-lib ? self.inputs.nix-pre-commit.lib."${system}"
, nix-fast-build ? self.outputs.packages."${system}".nix-fast-build
, ...
}:
pkgs.mkShell.override { stdenv = pkgs.stdenvNoCC; } {
packages = with pkgs; [
# Ensure reproducible shell interpretation and nix evaluation
nix
bash
git
# Enforce style, formatting, etc
pre-commit
commitizen
nixpkgs-fmt
deadnix
statix
# Nix maintainer helper tools
nix-update
# CI
cachix
nvchecker
nix-fast-build
];
shellHook = ''
[[ ! -a .pre-commit-config.yaml ]] && ln -fs /dev/null .pre-commit-config.yaml # fix nix-pre-commit
[[ -a .secrets ]] && source .secrets
'' +
(nix-pre-commit-lib.mkConfig {
inherit pkgs;
config = {
repos = [
{
repo = "local";
hooks = [
{
id = "nixpkgs-fmt";
entry = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt";
language = "system";
types = [ "nix" ];
}
];
}
{
repo = "local";
hooks = [
{
id = "commitizen";
name = "commitizen check";
entry = "${pkgs.commitizen}/bin/cz check";
args = [ "--allow-abort" "--commit-msg-file" ];
stages = [ "commit-msg" ];
language = "system";
}
];
}
{
repo = "local";
hooks = [
{
id = "deadnix";
name = "deadnix";
description = "Scan Nix files for dead code";
entry = "${pkgs.deadnix}/bin/deadnix";
args = [ "--edit" ];
types = [ "nix" ];
language = "system";
}
];
}
{
repo = "local";
hooks = [
{
id = "statix";
name = "statix";
description = "lints and suggestions for the nix programming language";
entry = "${pkgs.statix}/bin/statix";
#args = [ "check" ];
args = [ "fix" ];
types = [ "nix" ];
language = "system";
pass_filenames = false;
}
];
}
];
};
}).shellHook;
}