nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch2,
6 cmake,
7 curl,
8 gpgme,
9 libsolv,
10 libxml2,
11 pkg-config,
12 python3,
13 rpm,
14 sqlite,
15}:
16
17stdenv.mkDerivation (finalAttrs: {
18 pname = "tdnf";
19 version = "3.5.9";
20
21 src = fetchFromGitHub {
22 owner = "vmware";
23 repo = "tdnf";
24 rev = "v${finalAttrs.version}";
25 hash = "sha256-p9g+b7Fqq8V6QSaikEQMMHWqBf4UtRA9a/VtH+s5JUM=";
26 };
27
28 patches = [
29 # Support for rpm >= 4.19
30 (fetchpatch2 {
31 url = "https://patch-diff.githubusercontent.com/raw/vmware/tdnf/pull/410.patch";
32 hash = "sha256-p/ix5O1J/lj2fw7qJokT+wPN4ROoulnVqByfxgFvuEo=";
33 })
34 ];
35
36 nativeBuildInputs = [
37 cmake
38 pkg-config
39 python3
40 ];
41
42 buildInputs = [
43 curl.dev
44 gpgme.dev
45 libsolv
46 libxml2.dev
47 sqlite.dev
48 ];
49
50 propagatedBuildInputs = [
51 rpm
52 ];
53
54 cmakeFlags = [
55 "-DCMAKE_INSTALL_PREFIX=$out"
56 "-DCMAKE_INSTALL_FULL_SYSCONDIR=$out/etc"
57 "-DCMAKE_INSTALL_SYSCONFDIR=$out/etc"
58 "-DSYSTEMD_DIR=$out/lib/systemd/system"
59 ];
60
61 # error: format not a string literal and no format arguments [-Werror=format-security]
62 hardeningDisable = [ "format" ];
63
64 postPatch = ''
65 substituteInPlace CMakeLists.txt \
66 --replace-fail 'SYSCONFDIR /etc' 'SYSCONFDIR $out/etc' \
67 --replace-fail '/etc/motdgen.d' '$out/etc/motdgen.d'
68 substituteInPlace client/tdnf.pc.in \
69 --replace-fail 'libdir=''${prefix}/@CMAKE_INSTALL_LIBDIR@' 'libdir=@CMAKE_INSTALL_FULL_LIBDIR@'
70 substituteInPlace tools/cli/lib/tdnf-cli-libs.pc.in \
71 --replace-fail 'libdir=''${prefix}/@CMAKE_INSTALL_LIBDIR@' 'libdir=@CMAKE_INSTALL_FULL_LIBDIR@'
72 '';
73
74 # remove binaries used for testing from the final output
75 postInstall = "rm $out/bin/*test";
76
77 meta = {
78 description = "Tiny Dandified Yum";
79 homepage = "https://github.com/vmware/tdnf";
80 changelog = "https://github.com/vmware/tdnf/releases/tag/v${finalAttrs.version}";
81 license = with lib.licenses; [
82 gpl2
83 lgpl21
84 ];
85 maintainers = [ lib.maintainers.malt3 ];
86 mainProgram = "tdnf";
87 # rpm only supports linux
88 platforms = lib.platforms.linux;
89 };
90})