-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
96 lines (75 loc) · 1.97 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/948a31b4b765c01f485c05bdeb12b2197f440d5a";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
...
} @ inputs: (flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: {
poetry2nix = inputs.poetry2nix.lib.mkPoetry2Nix {pkgs = prev;};
})
];
};
poetryEnv = pkgs.poetry2nix.mkPoetryEnv {
projectDir = ./.;
preferWheels = true;
overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend (self: super: {
reportlab = super.reportlab.overridePythonAttrs (old: {
postPatch = "";
});
});
};
src = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [
./pyproject.toml
(pkgs.lib.fileset.fileFilter (file: file.hasExt "py") ./fs_schema_validator)
(pkgs.lib.fileset.fileFilter (file: file.hasExt "py") ./tests)
./tests/fixtures
];
};
in {
devShells.default = pkgs.mkShell {
packages = [
poetryEnv
pkgs.poetry
pkgs.just
];
};
checks = {
lint = pkgs.runCommand "lint" {} ''
cp -r ${src}/* .
${poetryEnv}/bin/ruff format --diff --check .
${poetryEnv}/bin/ruff check .
touch $out
'';
deptry = pkgs.runCommand "deptry" {} ''
cp -r ${src}/* .
${poetryEnv}/bin/deptry .
touch $out
'';
typecheck = pkgs.runCommand "typecheck" {} ''
cp -r ${src}/* .
${poetryEnv}/bin/mypy .
touch $out
'';
test = pkgs.runCommand "test" {} ''
cp -r ${src}/* .
${poetryEnv}/bin/pytest
touch $out
'';
};
formatter = pkgs.alejandra;
}));
}