depot/third_party/nixpkgs/pkgs/development/cuda-modules/write-gpu-python-test.nix

30 lines
550 B
Nix
Raw Normal View History

{
lib,
writers,
runCommand,
}:
{
feature ? "cuda",
name ? feature,
libraries ? [ ],
}:
content:
let
tester = writers.writePython3Bin "tester-${name}" { inherit libraries; } content;
tester' = tester.overrideAttrs (oldAttrs: {
passthru.gpuCheck =
runCommand "test-${name}"
{
nativeBuildInputs = [ tester' ];
requiredSystemFeatures = [ feature ];
}
''
set -e
${tester.meta.mainProgram or (lib.getName tester')}
touch $out
'';
});
in
tester'