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