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.

66 lines
1.3 KiB
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
, nixosTests
, 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
};
attrs = builtins.fromTOML (builtins.readFile ./pyproject.toml);
pname = attrs.project.name;
inherit (attrs.project) version;
2023-09-19 09:28:30 +00:00
in
python3Packages.buildPythonApplication
2023-09-19 09:28:30 +00:00
{
inherit pname version;
pyproject = true;
src = lib.cleanSource ./.;
nativeBuildInputs = [
makeWrapper
python3Packages.setuptools
];
postFixup = ''
wrapProgram $out/bin/${pname} --add-flags "--config ${confPath}"
'';
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 ];
};
}