Unverified Commit dbe55c59 authored by dotlambda's avatar dotlambda Committed by GitHub
Browse files

genealogos-cli: use fetchCargoVendor, move to pkgs/by-name (#391651)

parents 12f83c72 99126689
Loading
Loading
Loading
Loading
+55 −0
Original line number Diff line number Diff line
{
  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;
  };
}
+0 −2876

File deleted.

Preview size limit exceeded, changes collapsed.

+0 −63
Original line number Diff line number Diff line
{
  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";
        rev = "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/
        '';
      };

      cargoLock = {
        lockFile = ./Cargo.lock;
        outputHashes = {
          "nixtract-0.3.0" = "sha256-fXM6Gle4dt1iJgI6NuPl9l00i5sXGYkE+sUvFdps44s=";
        };
      };

      cargoBuildFlags = [
        "-p"
        "genealogos-${crate}"
      ];
      cargoTestFlags = cargoBuildFlags;

      nativeBuildInputs = [ pkg-config ];
      buildInputs = [ openssl ];

      # Since most tests were removed, just skip testing
      doCheck = false;

      meta = with lib; {
        description = "A Nix sbom generator";
        homepage = "https://github.com/tweag/genealogos";
        license = licenses.mit;
        maintainers = with maintainers; [ erin ];
        changelog = "https://github.com/tweag/genealogos/blob/${src.rev}/CHANGELOG.md";
        mainProgram = "genealogos";
        platforms = lib.platforms.unix;
      };
    };
in
{
  genealogos-cli = mkGenealogosPackage { };
  genealogos-api = mkGenealogosPackage { crate = "api"; };
}
+3 −1
Original line number Diff line number Diff line
@@ -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.