Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
2.0 KiB
Nix
Raw Permalink Normal View History

2024-11-08 16:21:05 -08:00
{
stdenv,
fetchFromGitHub,
lib,
nettle,
nix-update-script,
rustPlatform,
pkg-config,
runCommand,
}:
rustPlatform.buildRustPackage rec {
pname = "rpm-sequoia";
2025-07-17 05:40:21 +00:00
version = "1.9.0";
2024-11-08 16:21:05 -08:00
src = fetchFromGitHub {
owner = "rpm-software-management";
repo = "rpm-sequoia";
2025-04-07 08:23:42 +02:00
tag = "v${version}";
2025-07-17 05:40:21 +00:00
hash = "sha256-KYoxQwQTcc75VEwWXEhHd+GNowzC7JlcIf6r7WM4Els=";
2024-11-08 16:21:05 -08:00
};
2025-07-17 05:40:21 +00:00
cargoHash = "sha256-oKk768pgMYMJ3NTSlzqV1Y61fyu2DxY62JOpLKfUUY4=";
2024-11-08 16:21:05 -08:00
patches = [
./objdump.patch
];
nativeBuildInputs = [
pkg-config
rustPlatform.bindgenHook
];
propagatedBuildInputs = [ nettle ];
# Tests will parse the symbols, on darwin we have two issues:
# - library name is hardcoded to librpm_sequoia.so
# - The output of the objdump differs and the parsing logic needs to be adapted
doCheck = !stdenv.hostPlatform.isDarwin;
outputs = [
"out"
"dev"
];
# Ensure the generated .pc file gets the correct prefix
env.PREFIX = placeholder "out";
# Install extra files, the same as this is done on fedora:
# https://src.fedoraproject.org/rpms/rust-rpm-sequoia/blob/f41/f/rust-rpm-sequoia.spec#_81
preInstall =
# Install the generated pc file for consumption by the dependents
''
install -Dm644 target/release/rpm-sequoia.pc -t $dev/lib/pkgconfig
''
+
# Dependents will rely on the versioned symlinks
lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
2024-11-08 16:21:05 -08:00
install -d $out/lib
find target/release/ \
-maxdepth 1 \
-type l -name 'librpm_sequoia.*' \
-exec cp --no-dereference {} $out/lib/ \;
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
install -d $out/lib
ln -s librpm_sequoia.dylib $out/lib/librpm_sequoia.${version}.dylib
'';
2024-11-08 16:21:05 -08:00
passthru.updateScript = nix-update-script { };
meta = {
description = "OpenPGP backend for rpm using Sequoia PGP";
2024-11-08 16:21:05 -08:00
homepage = "https://sequoia-pgp.org/";
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ baloo ];
};
}