28 , darwinMinVersionHook
31 stdenv.mkDerivation rec {
36 url = "https://ftp.osuosl.org/pub/rpm/releases/rpm-${lib.versions.majorMinor version}.x/rpm-${version}.tar.bz2";
37 hash = "sha256-N/O0LAlmlB4q0/EP3jY5gkplkdBxl7qP0IacoHeeH1Y=";
41 # Resolves `error: expected expression` on clang
42 # See: https://github.com/rpm-software-management/rpm/issues/2435.
44 url = "https://github.com/rpm-software-management/rpm/commit/b960c0b43a080287a7c13533eeb2d9f288db1414.diff?full_index=1";
45 hash = "sha256-0f7YOL2xR07xgAEN32oRbOjPsAsVmKFVtTLXUOeFAa8=";
47 # Fix missing includes required to build on Darwin.
48 # See: https://github.com/rpm-software-management/rpm/pull/2571.
50 url = "https://github.com/rpm-software-management/rpm/commit/f07875392a09228b1a25c1763a50bbbd0f6798c2.diff?full_index=1";
51 hash = "sha256-DLpzMApRCgI9zqheglFtqL8E1vq9X/aQa0HMnIAQgk8=";
54 url = "https://github.com/rpm-software-management/rpm/commit/b2e67642fd8cb64d8cb1cca9e759396c1c10807d.diff?full_index=1";
55 hash = "sha256-q3fIBfiUJVmw6Vi2/Bo/zX6/cqTM7aFnskKfMVK3DlU=";
59 outputs = [ "out" "dev" "man" ];
60 separateDebugInfo = true;
62 nativeBuildInputs = [ autoreconfHook pkg-config pandoc ];
63 buildInputs = [ cpio zlib zstd bzip2 file libarchive libgcrypt nspr nss db xz python lua sqlite ]
64 ++ lib.optional stdenv.cc.isClang llvmPackages.openmp
65 ++ lib.optional stdenv.hostPlatform.isLinux libcap
66 ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_13 (darwinMinVersionHook "13.0") ];
68 # rpm/rpmlib.h includes popt.h, and then the pkg-config file mentions these as linkage requirements
69 propagatedBuildInputs = [ popt nss db bzip2 libarchive libbfd ]
70 ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform elfutils) elfutils;
72 env.NIX_CFLAGS_COMPILE = "-I${nspr.dev}/include/nspr -I${nss.dev}/include/nss";
81 "--localstatedir=/var"
82 "--sharedstatedir=/com"
83 ] ++ lib.optional stdenv.hostPlatform.isLinux "--with-cap";
86 substituteInPlace Makefile.am --replace '@$(MKDIR_P) $(DESTDIR)$(localstatedir)/tmp' ""
90 # Don't keep a reference to RPM headers or manpages
91 for f in $out/lib/rpm/platform/*/macros; do
92 substituteInPlace $f --replace "$dev" "/rpm-dev-path-was-here"
93 substituteInPlace $f --replace "$man" "/rpm-man-path-was-here"
96 # Avoid macros like '%__ld' pointing to absolute paths
97 for tool in ld nm objcopy objdump strip; do
98 sed -i $out/lib/rpm/macros -e "s/^%__$tool.*/%__$tool $tool/"
101 # Avoid helper scripts pointing to absolute paths
102 for tool in find-provides find-requires; do
103 sed -i $out/lib/rpm/$tool -e "s#/usr/lib/rpm/#$out/lib/rpm/#"
106 # symlinks produced by build are incorrect
107 ln -sf $out/bin/{rpm,rpmquery}
108 ln -sf $out/bin/{rpm,rpmverify}
111 enableParallelBuilding = true;
114 homepage = "https://www.rpm.org/";
115 license = with licenses; [ gpl2Plus lgpl21Plus ];
116 description = "RPM Package Manager";
117 maintainers = with maintainers; [ copumpkin ];
118 platforms = platforms.linux ++ platforms.darwin;