lol
1{ stdenv, fetchgit, autoconf, automake, boost, pkgconfig, libtool, acl, libxml2, btrfsProgs, dbus_libs, docbook_xsl, libxslt, docbook_xml_dtd_45, diffutils, pam, utillinux, attr, gettext }:
2
3stdenv.mkDerivation rec {
4 name = "snapper-0.2.4";
5
6 src = fetchgit {
7 url = "https://github.com/openSUSE/snapper";
8 rev = "24e18153f7a32d0185dcfb20f8b8a4709ba8fe4a";
9 sha256 = "ec4b829430bd7181995e66a26ac86e8ac71c27e77faf8eb06db71d645c6f859b";
10 };
11
12 buildInputs = [ autoconf automake boost pkgconfig libtool acl libxml2 btrfsProgs dbus_libs docbook_xsl libxslt docbook_xml_dtd_45 diffutils pam utillinux attr gettext ];
13
14 patchPhase = ''
15 # work around missing btrfs/version.h; otherwise, use "-DHAVE_BTRFS_VERSION_H"
16 substituteInPlace snapper/Btrfs.cc --replace "define BTRFS_LIB_VERSION (100)" "define BTRFS_LIB_VERSION (200)";
17 # fix strange SuSE boost naming
18 substituteInPlace snapper/Makefile.am --replace \
19 "libsnapper_la_LIBADD = -lboost_thread-mt -lboost_system-mt -lxml2 -lacl -lz -lm" \
20 "libsnapper_la_LIBADD = -lboost_thread -lboost_system -lxml2 -lacl -lz -lm";
21 # general cleanup
22 sed -i 's/^INCLUDES/AM_CPPFLAGS/' $(grep -rl ^INCLUDES .|grep "\.am$")
23 '';
24
25 configurePhase = ''
26 aclocal
27 libtoolize --force --automake --copy
28 autoheader
29 automake --add-missing --copy
30 autoconf
31
32 ./configure --disable-silent-rules --disable-ext4 --disable-btrfs-quota --prefix=$out
33 '';
34
35 makeFlags = "DESTDIR=$(out)";
36
37 NIX_CFLAGS_COMPILE = [ "-I${libxml2}/include/libxml2" ];
38
39 # Probably a hack, but using DESTDIR and PREFIX makes everything work!
40 postInstall = ''
41 cp -r $out/$out/* $out
42 rm -r $out/nix
43 '';
44
45 meta = with stdenv.lib; {
46 description = "Tool for Linux filesystem snapshot management";
47 homepage = http://snapper.io;
48 license = licenses.gpl2;
49 platforms = platforms.linux;
50 maintainers = [ maintainers.tstrobel ];
51 };
52}