Files
nixpkgs/pkgs/by-name/na/nanopb/generator-out.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

66 lines
1.2 KiB
Nix

{
stdenv,
cmake,
python3,
writeTextFile,
protobuf,
src,
version,
}:
let
pyproject_toml = writeTextFile {
name = "pyproject.toml";
text = ''
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
include-package-data = true
[tool.setuptools.packages.find]
where = ["src"]
[tool.setuptools.package-data]
"*" = ["nanopb.proto"]
[project]
name = "nanopb"
version = "${version}"
dependencies = [
"setuptools",
"protobuf",
"six"
]
'';
};
in
stdenv.mkDerivation {
pname = "nanopb-generator-out";
inherit src version;
nativeBuildInputs = [
cmake
protobuf
];
# don't let `find_program` find the bundled `protoc` script, so it will use the system `protoc` instead
preConfigure = ''
rm generator/protoc
'';
cmakeFlags = [
"-Dnanopb_BUILD_RUNTIME=OFF"
"-Dnanopb_BUILD_GENERATOR=ON"
"-Dnanopb_PYTHON_INSTDIR_OVERRIDE=${placeholder "out"}/${python3.sitePackages}"
];
postInstall = ''
rm -rf $out/include
rm -rf $out/lib/cmake
ln -s $out/${python3.sitePackages} $out/src
ln -s ${pyproject_toml} $out/pyproject.toml
'';
}