-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
62 lines (61 loc) · 1.7 KB
/
flake.nix
File metadata and controls
62 lines (61 loc) · 1.7 KB
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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
editorconfig.url = "github:Ookiiboy/editor-config/";
editorconfig.flake = false;
};
outputs = {
self,
systems,
nixpkgs,
pre-commit-hooks,
editorconfig,
...
}: let
forAllSystems = nixpkgs.lib.genAttrs (import systems);
in {
formatter = forAllSystems (system: let
pkgs = import nixpkgs {inherit system;};
in
pkgs.alejandra);
# https://github.com/cachix/git-hooks.nix?tab=readme-ov-file
# https://devenv.sh/reference/options/?query=pre-commit.hooks
checks = forAllSystems (system: {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
# Nix
alejandra.enable = true;
deadnix.enable = true;
statix.enable = true;
flake-checker.enable = true;
# Deno
denofmt.enable = true;
denolint.enable = true;
# JSON
check-json.enable = true;
# Generic - .editorconfig
editorconfig-checker.enable = true;
};
};
});
devShells = forAllSystems (system: let
pkgs = import nixpkgs {inherit system;};
in {
default = pkgs.mkShell {
name = "Local Development Shell";
shellHook = ''
ln -sf ${editorconfig}/.editorconfig ./.editorconfig
${self.checks.${system}.pre-commit-check.shellHook}
'';
buildInputs = with pkgs;
[
deno
]
++ self.checks.${system}.pre-commit-check.enabledPackages;
};
});
};
}