-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
103 lines (92 loc) · 2.53 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
94
95
96
97
98
99
100
101
102
103
{
inputs = {
flake-parts = {
inputs.nixpkgs-lib.follows = "nixpkgs";
url = "github:hercules-ci/flake-parts";
};
nixpkgs.url = "github:nixos/nixpkgs";
git-hooks-nix = {
inputs = {
nixpkgs-stable.follows = "nixpkgs";
nixpkgs.follows = "nixpkgs";
};
url = "github:cachix/git-hooks.nix";
};
treefmt-nix = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:numtide/treefmt-nix";
};
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"aarch64-linux"
"x86_64-linux"
];
imports = [
inputs.treefmt-nix.flakeModule
inputs.git-hooks-nix.flakeModule
];
flake.overlays.default = final: _: {
tune-nix-eval = final.python3Packages.callPackage ./package.nix { };
hoard = final.callPackage ./hoard.nix { };
mesh = final.callPackage ./mesh.nix { };
};
perSystem =
{
config,
pkgs,
...
}:
{
legacyPackages = pkgs.extend inputs.self.overlays.default;
packages = {
default = config.legacyPackages.tune-nix-eval;
};
pre-commit.settings.hooks =
let
nixToolConfig.enable = true;
in
{
# Formatter checks
treefmt = {
enable = true;
package = config.treefmt.build.wrapper;
};
# Nix checks
deadnix = nixToolConfig;
nil = nixToolConfig;
statix = nixToolConfig;
};
treefmt = {
projectRootFile = "flake.nix";
programs = {
# Markdown, YAML
# JSON is not formatted; it should not be modified because it is either vendored from NVIDIA or
# produced by a script.
prettier = {
enable = true;
includes = [
"*.md"
"*.yaml"
];
excludes = [ "*.json" ];
settings = {
embeddedLanguageFormatting = "auto";
printWidth = 120;
tabWidth = 2;
};
};
# Nix
nixfmt.enable = true;
# Python
ruff.enable = true;
# Shell
shellcheck.enable = true;
shfmt.enable = true;
};
};
};
};
}