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-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
|
|
|
};
|
|
|
|
pname = "nix-required-mounts";
|
|
|
|
in
|
|
|
|
|
|
|
|
runCommand pname
|
|
|
|
{
|
2023-10-18 09:44:59 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
python3Packages.wrapPython
|
|
|
|
];
|
2023-09-19 09:28:30 +00:00
|
|
|
meta.mainProgram = pname;
|
|
|
|
} ''
|
|
|
|
${lib.getExe buildPackages.python3.pkgs.flake8} ${./main.py}
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
2023-10-18 09:44:59 +00:00
|
|
|
install ${./main.py} $out/bin/${pname}
|
|
|
|
wrapProgram $out/bin/${pname} --add-flags "--config ${confPath}"
|
|
|
|
wrapPythonPrograms
|
2023-09-19 09:28:30 +00:00
|
|
|
''
|