summary refs log tree commit diff
path: root/pkgs/tools/misc/rpm-ostree/default.nix
blob: 8c2845dc8ebdecf7869f4eacfbbca4045e1fdbdb (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
{ stdenv, fetchFromGitHub, ostree, rpm, which, autoconf, automake, libtool, pkgconfig,
  libcap, glib, libgsystem, json-glib, libarchive, libsolv, librepo, gtk-doc, elfutils,
  gperf, cmake, pcre, check, python, libxslt, docbook_xsl, docbook_xml_dtd_42, acl }:

let
  libglnx-src = fetchFromGitHub {
    owner  = "GNOME";
    repo   = "libglnx";
    rev    = "4ae5e3beaaa674abfabf7404ab6fafcc4ec547db";
    sha256 = "1npb9zbyb4bl0nxqf0pcqankcwzs3k1x8i2wkdwhgak4qcvxvfqn";
  };

  libdnf-src = fetchFromGitHub {
    owner  = "rpm-software-management";
    repo   = "libhif";
    rev    = "b69552b3b3a42fd41698a925d5f5f623667bac63";
    sha256 = "0h6k09rb4imzbmsn7mspwl0js2awqdpb4ysdqq550vw2nr0dzszr";
  };

  version = "2016.10";
in stdenv.mkDerivation {
  name = "rpm-ostree-${version}";

  src = fetchFromGitHub {
    rev    = "v${version}";
    owner  = "projectatomic";
    repo   = "rpm-ostree";
    sha256 = "0a0wwklzk1kvk3bbxxfvxgk4ck5dn7a7v32shqidb674fr2d5pvb";
  };

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [
    which autoconf automake libtool libcap ostree rpm glib libgsystem gperf
    json-glib libarchive libsolv librepo gtk-doc libxslt docbook_xsl docbook_xml_dtd_42
    cmake pcre check python
    # FIXME: get rid of this once libarchive properly propagates this
    acl
  ];

  dontUseCmakeConfigure = true;

  prePatch = ''
    rmdir libglnx libdnf
    cp --no-preserve=mode -r ${libglnx-src} libglnx
    cp --no-preserve=mode -r ${libdnf-src} libdnf

    # According to #cmake on freenode, libdnf should bundle the FindLibSolv.cmake module
    cp ${libsolv}/share/cmake/Modules/FindLibSolv.cmake libdnf/cmake/modules/

    # See https://github.com/projectatomic/rpm-ostree/issues/480
    substituteInPlace src/libpriv/rpmostree-unpacker.c --replace 'include <selinux/selinux.h>' ""

    # libdnf normally wants sphinx to build its hawkey manpages, but we don't care about those manpages since we don't use hawkey
    substituteInPlace configure.ac --replace 'cmake \' 'cmake -DWITH_MAN=off \'

    # Let's not hardcode the rpm-gpg path...
    substituteInPlace libdnf/libdnf/dnf-keyring.c \
      --replace '"/etc/pki/rpm-gpg"' 'getenv("LIBDNF_RPM_GPG_PATH_OVERRIDE") ? getenv("LIBDNF_RPM_GPG_PATH_OVERRIDE") : "/etc/pki/rpm-gpg"'
  '';

  preConfigure = ''
    env NOCONFIGURE=1 ./autogen.sh
  '';

  meta = with stdenv.lib; {
    description = "A hybrid image/package system. It uses OSTree as an image format, and uses RPM as a component model";
    homepage    = "https://rpm-ostree.readthedocs.io/en/latest/";
    license     = licenses.lgpl2Plus;
    platforms   = platforms.linux;
    maintainers = with maintainers; [ copumpkin ];
  };
}