2023-09-19 09:28:30 +00:00
|
|
|
{ addOpenGLRunpath
|
|
|
|
, cmake
|
|
|
|
, allowedPatterns ? rec {
|
|
|
|
opengl.onFeatures = [ "opengl" ];
|
|
|
|
opengl.paths = [
|
|
|
|
addOpenGLRunpath.driverLink
|
|
|
|
"/dev/video*"
|
|
|
|
"/dev/dri"
|
|
|
|
];
|
|
|
|
cuda.onFeatures = [ "cuda" ];
|
|
|
|
cuda.paths = opengl.paths ++ [
|
|
|
|
"/dev/nvidia*"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
, buildPackages
|
|
|
|
, formats
|
|
|
|
, lib
|
|
|
|
, nix
|
2023-11-06 16:44:36 +00:00
|
|
|
, nixosTests
|
2023-10-18 09:44:59 +00:00
|
|
|
, python3Packages
|
|
|
|
, makeWrapper
|
2023-09-19 09:28:30 +00:00
|
|
|
, runCommand
|
|
|
|
}:
|
|
|
|
|
|
|
|
|
|
|
|
let
|
2023-10-18 09:44:59 +00:00
|
|
|
confPath = (formats.json { }).generate "config.py" {
|
|
|
|
inherit allowedPatterns;
|
|
|
|
nixExe = lib.getExe nix;
|
2023-09-19 09:28:30 +00:00
|
|
|
};
|
2023-11-06 17:21:47 +00:00
|
|
|
attrs = builtins.fromTOML (builtins.readFile ./pyproject.toml);
|
|
|
|
pname = attrs.project.name;
|
|
|
|
inherit (attrs.project) version;
|
2023-09-19 09:28:30 +00:00
|
|
|
in
|
|
|
|
|
2023-11-06 17:21:47 +00:00
|
|
|
python3Packages.buildPythonApplication
|
2023-09-19 09:28:30 +00:00
|
|
|
{
|
2023-11-06 17:21:47 +00:00
|
|
|
inherit pname version;
|
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
src = lib.cleanSource ./.;
|
|
|
|
|
2023-10-18 09:44:59 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
2023-11-06 17:21:47 +00:00
|
|
|
python3Packages.setuptools
|
2023-10-18 09:44:59 +00:00
|
|
|
];
|
2023-11-06 17:21:47 +00:00
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
wrapProgram $out/bin/${pname} --add-flags "--config ${confPath}"
|
|
|
|
'';
|
|
|
|
|
2023-11-06 16:44:14 +00:00
|
|
|
passthru = {
|
|
|
|
inherit allowedPatterns;
|
2023-11-06 16:44:36 +00:00
|
|
|
tests = {
|
|
|
|
inherit (nixosTests) nix-required-mounts;
|
|
|
|
};
|
2023-11-06 16:44:14 +00:00
|
|
|
};
|
2023-11-06 17:21:47 +00:00
|
|
|
meta = {
|
|
|
|
inherit (attrs.project) description;
|
|
|
|
homepage = attrs.project.urls.Homepage;
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
mainProgram = attrs.project.name;
|
|
|
|
maintainers = with lib.maintainers; [ SomeoneSerge ];
|
|
|
|
};
|
|
|
|
}
|