-
Notifications
You must be signed in to change notification settings - Fork 83
/
Copy pathpackage.nix
131 lines (117 loc) · 2.11 KB
/
package.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{
lib,
python3,
fetchFromGitHub,
makeWrapper,
e2fsprogs-nofortify,
jefferson,
lz4,
lziprecover,
lzop,
p7zip,
partclone,
nix-filter,
sasquatch,
sasquatch-v4be,
simg2img,
ubi_reader,
unar,
zstd,
versionCheckHook,
rustPlatform,
}:
let
# These dependencies are only added to PATH
runtimeDeps = [
e2fsprogs-nofortify
jefferson
lziprecover
lzop
p7zip
partclone
sasquatch
sasquatch-v4be
ubi_reader
simg2img
unar
zstd
lz4
];
pyproject_toml = (builtins.fromTOML (builtins.readFile ./pyproject.toml));
version = pyproject_toml.project.version;
in
python3.pkgs.buildPythonApplication rec {
pname = "unblob";
pyproject = true;
disabled = python3.pkgs.pythonOlder "3.9";
inherit version;
src = nix-filter {
root = ./.;
include = [
"Cargo.lock"
"Cargo.toml"
"pyproject.toml"
"python"
"rust"
"tests"
"README.md"
];
};
strictDeps = true;
build-system = with python3.pkgs; [ poetry-core ];
dependencies = with python3.pkgs; [
arpy
attrs
click
cryptography
dissect-cstruct
lark
lief.py
python3.pkgs.lz4 # shadowed by pkgs.lz4
plotext
pluggy
pyfatfs
pyperscan
python-magic
pyzstd
rarfile
rich
structlog
treelib
unblob-native
];
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = with rustPlatform; [
cargoSetupHook
maturinBuildHook
makeWrapper
];
# These are runtime-only CLI dependencies, which are used through
# their CLI interface
pythonRemoveDeps = [
"jefferson"
"ubi-reader"
];
pythonImportsCheck = [ "unblob" ];
makeWrapperArgs = [
"--prefix PATH : ${lib.makeBinPath runtimeDeps}"
];
nativeCheckInputs =
with python3.pkgs;
[
pytestCheckHook
pytest-cov
versionCheckHook
]
++ runtimeDeps;
versionCheckProgramArg = "--version";
pytestFlagsArray = [
"--no-cov"
];
passthru = {
# helpful to easily add these to a nix-shell environment
inherit runtimeDeps;
};
}