-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
100 lines (93 loc) · 2.44 KB
/
flake.nix
File metadata and controls
100 lines (93 loc) · 2.44 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
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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
git-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
git-hooks,
}: let
applySystems = nixpkgs.lib.genAttrs ["x86_64-linux"];
forAllSystems = f:
applySystems (
system:
f (import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
})
);
in {
checks = forAllSystems (
pkgs: {
pre-commit-check = git-hooks.lib.${pkgs.stdenv.hostPlatform.system}.run {
src = ./.;
hooks =
{
commit-name = {
enable = true;
name = "commit name";
stages = ["commit-msg"];
entry = ''
${pkgs.python310.interpreter} ${./scripts/apply-commit-convention.py}
'';
};
}
// pkgs.lib.genAttrs [
"black"
"isort"
"trim-trailing-whitespace"
"deadnix"
"alejandra"
] (_: {enable = true;});
};
}
);
devShells = forAllSystems (pkgs: let
py-env = pkgs.python3.withPackages (
_:
with self.packages.${pkgs.stdenv.hostPlatform.system}.default;
optional-dependencies.dev
);
in {
default = pkgs.mkShell {
inherit (self.checks.${pkgs.stdenv.hostPlatform.system}.pre-commit-check) shellHook;
env.LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
pkgs.stdenv.cc.cc.lib
pkgs.libz
];
packages = [
py-env
];
};
});
packages = forAllSystems (pkgs:
with pkgs; {
default = python3Packages.buildPythonApplication {
name = "my_torch_analyzer";
version = "0.0.1";
pyproject = true;
src = ./.;
build-system = [python3Packages.hatchling];
optional-dependencies = with python3Packages; {
dev = [
black
isort
matplotlib
];
};
meta = {
description = "A clash of kings";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [cizniarova];
mainProgram = "my_torch_analyzer";
};
};
});
};
}