nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchFromGitHub
2, autoreconfHook, pkgconfig, docbook_xsl, libxslt, docbook_xml_dtd_45
3, acl, attr, boost, btrfs-progs, dbus, diffutils, e2fsprogs, libxml2
4, lvm2, pam, python, utillinux, fetchpatch, json_c, nixosTests }:
5
6stdenv.mkDerivation rec {
7 pname = "snapper";
8 version = "0.8.12";
9
10 src = fetchFromGitHub {
11 owner = "openSUSE";
12 repo = "snapper";
13 rev = "v${version}";
14 sha256 = "0vkzncgyf1l2wcr5qd615qbd0hmclfrblg38mx52m707z3wyv88v";
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 diffutils e2fsprogs libxml2
23 lvm2 pam python utillinux json_c
24 ];
25
26 passthru.tests.snapper = nixosTests.snapper;
27
28 patches = [
29 # Don't use etc/dbus-1/system.d
30 (fetchpatch {
31 url = "https://github.com/openSUSE/snapper/commit/c51708aea22d9436da287cba84424557ad03644b.patch";
32 sha256 = "106pf7pv8z3q37c8ckmgwxs1phf2fy7l53a9g5xq5kk2rjj1cx34";
33 })
34 ];
35
36 postPatch = ''
37 # Hard-coded root paths, hard-coded root paths everywhere...
38 for file in {client,data,pam,scripts,zypp-plugin}/Makefile.am; do
39 substituteInPlace $file \
40 --replace '$(DESTDIR)/usr' "$out" \
41 --replace "DESTDIR" "out" \
42 --replace "/usr" "$out"
43 done
44 substituteInPlace pam/Makefile.am \
45 --replace '/`basename $(libdir)`' "$out/lib"
46 '';
47
48 configureFlags = [
49 "--disable-ext4" # requires patched kernel & e2fsprogs
50 ];
51
52 enableParallelBuilding = true;
53
54 NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2";
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 markuskowa ];
74 };
75}