about summary refs log tree commit diff
path: root/pkgs/by-name/td/tdnf/package.nix
blob: e6c339d1e1d2ad1c3e0443abb09297d98e1d888d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{ lib
, stdenv
, fetchFromGitHub
, cmake
, curl
, gpgme
, libsolv
, libxml2
, pkg-config
, python3
, rpm
, sqlite
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "tdnf";
  version = "3.5.6";

  src = fetchFromGitHub {
    owner = "vmware";
    repo = "tdnf";
    rev = "v${finalAttrs.version}";
    hash = "sha256-gj0IW0EwWBXi2s7xFdghop8f1lMhkUJVAkns5nnl7sg=";
  };

  nativeBuildInputs = [
    cmake
    pkg-config
    python3
  ];

  buildInputs = [
    curl.dev
    gpgme.dev
    libsolv
    libxml2.dev
    sqlite.dev
  ];

  propagatedBuildInputs = [
    rpm
  ];

  cmakeFlags = [
    "-DCMAKE_INSTALL_PREFIX=$out"
    "-DCMAKE_INSTALL_FULL_SYSCONDIR=$out/etc"
    "-DCMAKE_INSTALL_SYSCONFDIR=$out/etc"
    "-DSYSTEMD_DIR=$out/lib/systemd/system"
  ];

  # error: format not a string literal and no format arguments [-Werror=format-security]
  hardeningDisable = [ "format" ];

  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace-fail 'SYSCONFDIR /etc' 'SYSCONFDIR $out/etc' \
      --replace-fail '/etc/motdgen.d' '$out/etc/motdgen.d'
    substituteInPlace client/tdnf.pc.in \
      --replace-fail 'libdir=''${prefix}/@CMAKE_INSTALL_LIBDIR@' 'libdir=@CMAKE_INSTALL_FULL_LIBDIR@'
    substituteInPlace tools/cli/lib/tdnf-cli-libs.pc.in \
      --replace-fail 'libdir=''${prefix}/@CMAKE_INSTALL_LIBDIR@' 'libdir=@CMAKE_INSTALL_FULL_LIBDIR@'
  '';

  # remove binaries used for testing from the final output
  postInstall = "rm $out/bin/*test";

  meta = {
    description = "Tiny Dandified Yum";
    homepage = "https://github.com/vmware/tdnf";
    changelog = "https://github.com/vmware/tdnf/releases/tag/v${finalAttrs.version}";
    license = with lib.licenses; [ gpl2 lgpl21 ];
    maintainers = [ lib.maintainers.malt3 ];
    mainProgram = "tdnf";
    # rpm only supports linux
    platforms = lib.platforms.linux;
  };
})