-
-
Notifications
You must be signed in to change notification settings - Fork 35
/
flake.nix
75 lines (68 loc) · 1.8 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
{
inputs = {
devshell = {
url = "github:numtide/devshell";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = {
self,
devshell,
flake-utils,
nixpkgs,
pre-commit-hooks,
}:
flake-utils.lib.eachDefaultSystem (
localSystem: let
pkgs = import nixpkgs {
inherit localSystem;
overlays = [devshell.overlays.default];
};
in {
checks.pre-commit = pre-commit-hooks.lib.${localSystem}.run {
src = ./.;
hooks = {
alejandra.enable = true;
statix.enable = true;
};
};
# `nix develop`
devShells.default = pkgs.devshell.mkShell {
name = "vane";
commands = [
{
package = pkgs.alejandra;
help = "Format nix code";
}
{
package = pkgs.statix;
help = "Lint nix code";
}
{
package = pkgs.deadnix;
help = "Find unused expressions in nix code";
}
];
devshell.startup.pre-commit.text = self.checks.${localSystem}.pre-commit.shellHook;
packages = [
pkgs.temurin-bin
(pkgs.gradle.override {java = pkgs.temurin-bin;})
(pkgs.python3.withPackages (ps: [
ps.markdown
ps.toml
ps.pyyaml
]))
pkgs.nodejs
];
};
formatter = pkgs.alejandra; # `nix fmt`
}
);
}