1{ stdenv, fetchFromGitHub
2, autoreconfHook, pkgconfig, docbook_xsl, libxslt, docbook_xml_dtd_45
3, acl, attr, boost, btrfs-progs, dbus_libs, diffutils, e2fsprogs, libxml2
4, lvm2, pam, python, utillinux }:
5
6stdenv.mkDerivation rec {
7 name = "snapper-${version}";
8 version = "0.3.3";
9
10 src = fetchFromGitHub {
11 owner = "openSUSE";
12 repo = "snapper";
13 rev = "v${version}";
14 sha256 = "12c2ygaanr4gny4ixnly4vpi0kv7snbg3khr3i5zwridhmdzz9hm";
15 };
16
17 nativeBuildInputs = [
18 autoreconfHook pkgconfig
19 docbook_xsl libxslt docbook_xml_dtd_45
20 ];
21 buildInputs = [
22 acl attr boost btrfs-progs dbus_libs diffutils e2fsprogs libxml2
23 lvm2 pam python utillinux
24 ];
25
26 postPatch = ''
27 # Hard-coded root paths, hard-coded root paths everywhere...
28 for file in {client,data,pam,scripts}/Makefile.am; do
29 substituteInPlace $file \
30 --replace '$(DESTDIR)/usr' "$out" \
31 --replace "DESTDIR" "out" \
32 --replace "/usr" "$out"
33 done
34 substituteInPlace pam/Makefile.am \
35 --replace '/`basename $(libdir)`' "$out/lib"
36 '';
37
38 configureFlags = [
39 "--disable-ext4" # requires patched kernel & e2fsprogs
40 ];
41
42 enableParallelBuilding = true;
43
44 NIX_CFLAGS_COMPILE = [
45 "-I${libxml2.dev}/include/libxml2"
46 ];
47
48 postInstall = ''
49 rm -r $out/etc/cron.*
50 patchShebangs $out/lib/zypp/plugins/commit/*
51 for file in \
52 $out/lib/pam_snapper/* \
53 $out/lib/systemd/system/* \
54 $out/share/dbus-1/system-services/* \
55 ; do
56 substituteInPlace $file --replace "/usr" "$out"
57 done
58 '';
59
60 meta = with stdenv.lib; {
61 description = "Tool for Linux filesystem snapshot management";
62 homepage = http://snapper.io;
63 license = licenses.gpl2;
64 platforms = platforms.linux;
65 maintainers = with maintainers; [ nckx tstrobel ];
66 };
67}