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