genealogos-cli: move to pkgs/by-name

This commit is contained in:
Robert Schütz 2025-03-20 13:02:48 -07:00
parent a91bb21a60
commit 9912668947
3 changed files with 58 additions and 64 deletions

View file

@ -0,0 +1,55 @@
{
lib,
rustPlatform,
fetchFromGitHub,
pkg-config,
openssl,
crate ? "cli",
}:
rustPlatform.buildRustPackage rec {
pname = "genealogos-${crate}";
version = "1.0.0";
src = fetchFromGitHub {
owner = "tweag";
repo = "genealogos";
tag = "v${version}";
hash = "sha256-EQrKInsrqlpjySX6duylo++2qwglB3EqGfLFJucOQM8=";
# Genealogos' fixture tests contain valid nix store paths, and are thus incompatible with a fixed-output-derivation.
# To avoid this, we just remove the tests
postFetch = ''
rm -r $out/genealogos/tests/
'';
};
useFetchCargoVendor = true;
cargoHash = "sha256-R3HQXPpTtqgXfc7nLNdJp5zUMEpfccKWOQtS5Y786Jc=";
cargoBuildFlags = [
"-p"
"genealogos-${crate}"
];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ];
# Since most tests were removed, just skip testing
doCheck = false;
meta = {
description = "Nix sbom generator";
homepage = "https://github.com/tweag/genealogos";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ erin ];
changelog = "https://github.com/tweag/genealogos/blob/${src.tag}/CHANGELOG.md";
mainProgram =
{
api = "genealogos-api";
cli = "genealogos";
}
.${crate};
platforms = lib.platforms.unix;
};
}

View file

@ -1,63 +0,0 @@
{
lib,
rustPlatform,
fetchFromGitHub,
pkg-config,
openssl,
}:
let
mkGenealogosPackage =
{
crate ? "cli",
}:
rustPlatform.buildRustPackage rec {
pname = "genealogos-${crate}";
version = "1.0.0";
src = fetchFromGitHub {
owner = "tweag";
repo = "genealogos";
tag = "v${version}";
hash = "sha256-EQrKInsrqlpjySX6duylo++2qwglB3EqGfLFJucOQM8=";
# Genealogos' fixture tests contain valid nix store paths, and are thus incompatible with a fixed-output-derivation.
# To avoid this, we just remove the tests
postFetch = ''
rm -r $out/genealogos/tests/
'';
};
useFetchCargoVendor = true;
cargoHash = "sha256-R3HQXPpTtqgXfc7nLNdJp5zUMEpfccKWOQtS5Y786Jc=";
cargoBuildFlags = [
"-p"
"genealogos-${crate}"
];
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ];
# Since most tests were removed, just skip testing
doCheck = false;
meta = {
description = "Nix sbom generator";
homepage = "https://github.com/tweag/genealogos";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ erin ];
changelog = "https://github.com/tweag/genealogos/blob/${src.tag}/CHANGELOG.md";
mainProgram =
{
api = "genealogos-api";
cli = "genealogos";
}
.${crate};
platforms = lib.platforms.unix;
};
};
in
{
genealogos-cli = mkGenealogosPackage { };
genealogos-api = mkGenealogosPackage { crate = "api"; };
}

View file

@ -1000,7 +1000,9 @@ with pkgs;
inherit (darwin.apple_sdk.frameworks) ApplicationServices Carbon Cocoa VideoToolbox;
};
inherit (callPackage ../development/tools/genealogos { }) genealogos-cli genealogos-api;
genealogos-api = genealogos-cli.override {
crate = "api";
};
# This is to workaround gfal2-python broken against Python 3.12 or later.
# TODO: Remove these lines after solving the breakage.