blob: 197e0812a8ec57cd4e32e6950b4d13b88a20f5bc (
plain) (
blame)
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
|
{
addOpenGLRunpath,
allowedPatternsPath ? callPackage ./closure.nix { inherit allowedPatterns; },
allowedPatterns ? rec {
# This config is just an example.
# When the hook observes either of the following requiredSystemFeatures:
nvidia-gpu.onFeatures = [
"gpu"
"nvidia-gpu"
"opengl"
"cuda"
];
# It exposes these paths in the sandbox:
nvidia-gpu.paths = [
addOpenGLRunpath.driverLink
"/dev/dri"
"/dev/nvidia*"
];
nvidia-gpu.unsafeFollowSymlinks = true;
},
callPackage,
extraWrapperArgs ? [ ],
lib,
makeWrapper,
nix,
nixosTests,
python3Packages,
}:
let
attrs = builtins.fromTOML (builtins.readFile ./pyproject.toml);
pname = attrs.project.name;
inherit (attrs.project) version;
in
python3Packages.buildPythonApplication {
inherit pname version;
pyproject = true;
src = lib.cleanSource ./.;
nativeBuildInputs = [
makeWrapper
python3Packages.setuptools
];
postFixup = ''
wrapProgram $out/bin/${pname} \
--add-flags "--patterns ${allowedPatternsPath}" \
--add-flags "--nix-exe ${lib.getExe nix}" \
${builtins.concatStringsSep " " extraWrapperArgs}
'';
passthru = {
inherit allowedPatterns;
tests = {
inherit (nixosTests) nix-required-mounts;
};
};
meta = {
inherit (attrs.project) description;
homepage = attrs.project.urls.Homepage;
license = lib.licenses.mit;
mainProgram = attrs.project.name;
maintainers = with lib.maintainers; [ SomeoneSerge ];
};
}
|