nixpkgs/pkgs/by-name/ni/nix-required-mounts/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
882 B
Nix
Raw Normal View History

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
, python3Packages
, makeWrapper
2023-09-19 09:28:30 +00:00
, runCommand
}:
let
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
{
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
install ${./main.py} $out/bin/${pname}
wrapProgram $out/bin/${pname} --add-flags "--config ${confPath}"
wrapPythonPrograms
2023-09-19 09:28:30 +00:00
''