Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 147 lines 3.0 kB view raw
1{ 2 stdenv, 3 lib, 4 pkg-config, 5 cmake, 6 fetchurl, 7 zlib, 8 bzip2, 9 file, 10 elfutils, 11 libarchive, 12 readline, 13 audit, 14 popt, 15 xz, 16 python3, 17 lua, 18 llvmPackages, 19 sqlite, 20 zstd, 21 libcap, 22 apple-sdk_13, 23 darwinMinVersionHook, 24 openssl, 25 #, libselinux 26 rpm-sequoia, 27 gettext, 28 systemd, 29 bubblewrap, 30 autoconf, 31 gnupg, 32 33 # Disable the unshare RPM plugin, which can be useful if 34 # RPM is ran within the Nix sandbox. 35 disableUnshare ? true, 36}: 37 38stdenv.mkDerivation rec { 39 pname = "rpm"; 40 version = "4.20.1"; 41 42 src = fetchurl { 43 url = "https://ftp.osuosl.org/pub/rpm/releases/rpm-${lib.versions.majorMinor version}.x/rpm-${version}.tar.bz2"; 44 hash = "sha256-UmR+EmODZFM6tnHLyOSFyW+fCIidk/4O0QSmYyZhEk8="; 45 }; 46 47 postPatch = '' 48 sed -i 's#''${Python3_SITEARCH}#${placeholder "out"}/${python3.sitePackages}#' python/CMakeLists.txt 49 sed -i 's#PATHS ENV MYPATH#PATHS ENV PATH#' CMakeLists.txt 50 '' 51 # clang: error: unknown argument: '-fhardened' 52 + lib.optionalString stdenv.cc.isClang '' 53 substituteInPlace CMakeLists.txt \ 54 --replace-fail "-fhardened" "" 55 ''; 56 57 outputs = [ 58 "out" 59 "man" 60 ] 61 ++ lib.optionals stdenv.hostPlatform.isLinux [ 62 "dev" 63 ]; 64 separateDebugInfo = true; 65 66 nativeBuildInputs = [ 67 cmake 68 pkg-config 69 autoconf 70 python3 71 gettext 72 ] 73 ++ lib.optionals stdenv.hostPlatform.isLinux [ bubblewrap ]; 74 buildInputs = [ 75 bzip2 76 zlib 77 zstd 78 file 79 libarchive 80 xz 81 lua 82 sqlite 83 openssl 84 readline 85 rpm-sequoia 86 gnupg 87 ] 88 ++ lib.optional stdenv.cc.isClang llvmPackages.openmp 89 ++ lib.optionals stdenv.hostPlatform.isLinux [ 90 libcap 91 audit 92 systemd 93 ] 94 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 95 apple-sdk_13 96 (darwinMinVersionHook "13.0") 97 ]; 98 99 patches = lib.optionals stdenv.hostPlatform.isDarwin [ 100 ./sighandler_t-macos.patch 101 ]; 102 103 cmakeFlags = [ 104 "-DWITH_DBUS=OFF" 105 # libselinux is missing propagatedBuildInputs 106 "-DWITH_SELINUX=OFF" 107 108 "-DCMAKE_INSTALL_LOCALSTATEDIR=/var" 109 ] 110 ++ lib.optionals stdenv.hostPlatform.isLinux [ 111 "-DMKTREE_BACKEND=rootfs" 112 ] 113 ++ lib.optionals (!stdenv.hostPlatform.isLinux) [ 114 # Test suite rely on either podman or bubblewrap 115 "-DENABLE_TESTSUITE=OFF" 116 117 "-DWITH_CAP=OFF" 118 "-DWITH_AUDIT=OFF" 119 "-DWITH_ACL=OFF" 120 ] 121 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 122 "-DWITH_LIBELF=OFF" 123 "-DWITH_LIBDW=OFF" 124 ] 125 ++ lib.optionals disableUnshare [ 126 "-DHAVE_UNSHARE=OFF" 127 ]; 128 129 # rpm/rpmlib.h includes popt.h, and then the pkg-config file mentions these as linkage requirements 130 propagatedBuildInputs = [ 131 popt 132 ] 133 ++ lib.optional (lib.meta.availableOn stdenv.hostPlatform elfutils) elfutils; 134 135 enableParallelBuilding = true; 136 137 meta = with lib; { 138 homepage = "https://www.rpm.org/"; 139 license = with licenses; [ 140 gpl2Plus 141 lgpl21Plus 142 ]; 143 description = "RPM Package Manager"; 144 maintainers = [ ]; 145 platforms = platforms.linux ++ platforms.darwin; 146 }; 147}