2024-09-19 14:19:46 +00:00
|
|
|
{
|
|
|
|
fetchFromGitHub,
|
|
|
|
lib,
|
|
|
|
makeWrapper,
|
|
|
|
nodejs,
|
|
|
|
node-gyp,
|
|
|
|
pnpm_9,
|
|
|
|
python3,
|
|
|
|
stdenv,
|
|
|
|
xcbuild,
|
2023-02-02 18:25:31 +00:00
|
|
|
}:
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2023-02-02 18:25:31 +00:00
|
|
|
pname = "cdxgen";
|
2024-10-11 05:15:48 +00:00
|
|
|
version = "10.10.4";
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2024-09-19 14:19:46 +00:00
|
|
|
owner = "CycloneDX";
|
|
|
|
repo = "cdxgen";
|
|
|
|
rev = "v${finalAttrs.version}";
|
2024-10-11 05:15:48 +00:00
|
|
|
hash = "sha256-5FxH9cAJ9FoSn1euimKOvxlAEny+LUqj/EH80+l1v04=";
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
nodejs
|
|
|
|
node-gyp # required for sqlite3 bindings
|
|
|
|
pnpm_9.configHook
|
|
|
|
python3 # required for sqlite3 bindings
|
2024-09-26 11:04:55 +00:00
|
|
|
] ++ lib.optional stdenv.hostPlatform.isDarwin [ xcbuild ];
|
2023-02-02 18:25:31 +00:00
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
pnpmDeps = pnpm_9.fetchDeps {
|
|
|
|
inherit (finalAttrs) pname version src;
|
2024-10-23 06:41:50 +00:00
|
|
|
hash = "sha256-GdFU8mx9H3daxziprIOQWZWEBcz9y9Qk88sus838Xlk=";
|
2024-09-19 14:19:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
pushd node_modules/sqlite3
|
|
|
|
node-gyp rebuild
|
|
|
|
popd
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir -p $out/bin $out/lib
|
|
|
|
cp -r * $out/lib
|
|
|
|
makeWrapper ${nodejs}/bin/node "$out/bin/cdxgen" --add-flags "$out/lib/bin/cdxgen.js"
|
|
|
|
makeWrapper ${nodejs}/bin/node "$out/bin/cdxgen-evinse" --add-flags "$out/lib/bin/evinse.js"
|
|
|
|
makeWrapper ${nodejs}/bin/node "$out/bin/cdxgen-repl" --add-flags "$out/lib/bin/repl.js"
|
|
|
|
makeWrapper ${nodejs}/bin/node "$out/bin/cdxgen-verify" --add-flags "$out/lib/bin/verify.js"
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Creates CycloneDX Software Bill-of-Materials (SBOM) for your projects from source and container images";
|
2024-09-19 14:19:46 +00:00
|
|
|
mainProgram = "cdxgen";
|
|
|
|
homepage = "https://github.com/CycloneDX/cdxgen";
|
2023-02-02 18:25:31 +00:00
|
|
|
license = licenses.asl20;
|
2024-09-19 14:19:46 +00:00
|
|
|
maintainers = with maintainers; [
|
|
|
|
dit7ya
|
|
|
|
quincepie
|
|
|
|
];
|
2023-02-02 18:25:31 +00:00
|
|
|
};
|
2024-09-19 14:19:46 +00:00
|
|
|
})
|