-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
117 lines (108 loc) · 3.18 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{
description = "TODO FIXME";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
};
outputs = {
self,
flake-utils,
nixpkgs,
pre-commit-hooks,
...
}:
flake-utils.lib.eachSystem [flake-utils.lib.system.x86_64-linux] (system: let
# flake-utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {
inherit system;
};
inherit (pkgs) lib;
src = lib.cleanSource ./.;
python310Packages = pkgs.python310Packages.override {
overrides = final: prev: {
typer = prev.typer.overrideAttrs (_: {meta.broken = false;});
};
};
deduper = with python310Packages;
buildPythonApplication {
inherit src;
propagatedBuildInputs = [bitmath typer];
propagatedNativeBuildInputs = [pkgs.czkawka pkgs.ffmpeg];
checkInputs = [pytestCheckHook];
format = "flit";
pname = "deduper";
version = "0.0.1";
};
in {
checks = {
inherit deduper;
pre-commit = pre-commit-hooks.lib.${system}.run {
inherit src;
hooks = rec {
alejandra.enable = true;
black.enable = true;
isort.enable = true;
markdown-linter = {
enable = true;
entry = with pkgs; "${mdl}/bin/mdl -g";
language = "system";
name = "markdown-linter";
pass_filenames = true;
types = ["markdown"];
};
pyright = {
# cant find imports 😢
enable = false;
entry = "${pkgs.writeShellApplication {
name = "check-pyright";
runtimeInputs = with python310Packages; [
pkgs.nodePackages.pyright
bitmath
pytest
typer
python
];
text = "pyright";
}}/bin/check-pyright";
name = "pyright";
pass_filenames = false;
types = ["file" "python"];
};
statix.enable = true;
};
};
};
packages.default = deduper;
apps.default = flake-utils.lib.mkApp {
drv = deduper;
};
devShells.default = pkgs.mkShell {
inherit (self.packages.${system}.default) propagatedNativeBuildInputs;
shellHook =
self.checks.${system}.pre-commit.shellHook
+ ''
export PYTHONBREAKPOINT=ipdb.set_trace
'';
inputsFrom = [self.packages.${system}.default];
buildInputs = with python310Packages; [
pkgs.cachix
pkgs.nodePackages.pyright
self.packages.${system}.default
# python dev deps (but not CI test deps)
black
flit
ipdb
ipython
isort
pytest
python
];
};
formatter = pkgs.alejandra;
});
}