nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 pkg-config,
7 docbook_xsl,
8 libxslt,
9 docbook_xml_dtd_45,
10 acl,
11 attr,
12 boost,
13 btrfs-progs,
14 coreutils,
15 dbus,
16 diffutils,
17 e2fsprogs,
18 libxml2,
19 lvm2,
20 pam,
21 util-linux,
22 json_c,
23 nixosTests,
24 ncurses,
25 zlib,
26}:
27
28stdenv.mkDerivation (finalAttrs: {
29 pname = "snapper";
30 version = "0.13.0";
31
32 src = fetchFromGitHub {
33 owner = "openSUSE";
34 repo = "snapper";
35 tag = "v${finalAttrs.version}";
36 hash = "sha256-8rIjfulMuh4HzZv08bX7gveJAo2X2GvswmBD3Ziu0NM=";
37 };
38
39 strictDeps = true;
40
41 nativeBuildInputs = [
42 autoreconfHook
43 pkg-config
44 docbook_xsl
45 libxslt
46 docbook_xml_dtd_45
47 ];
48 buildInputs = [
49 acl
50 attr
51 boost
52 btrfs-progs
53 dbus
54 diffutils
55 e2fsprogs
56 libxml2
57 lvm2
58 pam
59 util-linux
60 json_c
61 ncurses
62 zlib
63 ];
64
65 # Hard-coded root paths, hard-coded root paths everywhere...
66 postPatch = ''
67 for file in {client/installation-helper,client/systemd-helper,data,scripts,zypp-plugin,scripts/completion}/Makefile.am; do
68 substituteInPlace $file \
69 --replace-warn '$(DESTDIR)/usr' "$out" \
70 --replace-warn "DESTDIR" "out" \
71 --replace-warn "/usr" "$out"
72 done
73 '';
74
75 configureFlags = [
76 "--disable-ext4" # requires patched kernel & e2fsprogs
77 "DIFFBIN=${diffutils}/bin/diff"
78 "RMBIN=${coreutils}/bin/rm"
79 ];
80
81 enableParallelBuilding = true;
82
83 postInstall = ''
84 rm -r $out/etc/cron.*
85 patchShebangs $out/lib/zypp/plugins/commit/*
86 for file in \
87 $out/lib/pam_snapper/* \
88 $out/lib/systemd/system/* \
89 $out/share/dbus-1/system-services/* \
90 ; do
91 substituteInPlace $file --replace-warn "/usr" "$out"
92 done
93 '';
94
95 passthru.tests.snapper = nixosTests.snapper;
96
97 meta = {
98 description = "Tool for Linux filesystem snapshot management";
99 homepage = "http://snapper.io";
100 license = lib.licenses.gpl2Only;
101 mainProgram = "snapper";
102 maintainers = with lib.maintainers; [ markuskowa ];
103 platforms = lib.platforms.linux;
104 };
105})