snapper: various tweaks and fixes

Fix numerous configuration files referring to ‘/usr’ and ‘/lib’.

Some paths were still ending up in ‘/nix/store/.../nix/store/...’,
despite some well-intended hacks meant to avoid that. Replace them
with other hacks. It's all very fragile and ugly, so snapper should
feel right at home.

Oh, and `snapper create-config ~` still won't actually *do*
anything, because D-Bus (#12452). Use `--no-dbus` and add files
to ‘/etc’ as long as it complains.

Only fair that I help maintain this mess.

+33 -18
+33 -18
pkgs/tools/misc/snapper/default.nix
··· 1 1 { stdenv, fetchFromGitHub 2 2 , autoreconfHook, pkgconfig, docbook_xsl, libxslt, docbook_xml_dtd_45 3 3 , acl, attr, boost, btrfs-progs, dbus_libs, diffutils, e2fsprogs, libxml2 4 - , lvm2, pam, utillinux }: 4 + , lvm2, pam, python, utillinux }: 5 5 6 6 stdenv.mkDerivation rec { 7 - name = "snapper-${ver}"; 8 - ver = "0.2.8"; 7 + name = "snapper-${version}"; 8 + version = "0.2.8"; 9 9 10 10 src = fetchFromGitHub { 11 11 owner = "openSUSE"; 12 12 repo = "snapper"; 13 - rev = "v${ver}"; 13 + rev = "v${version}"; 14 14 sha256 = "1rj8vy6hq140pbnc7mjjb34mfqdgdah1dmlv2073izdgakh7p38j"; 15 15 }; 16 16 ··· 20 20 ]; 21 21 buildInputs = [ 22 22 acl attr boost btrfs-progs dbus_libs diffutils e2fsprogs libxml2 23 - lvm2 pam utillinux 23 + lvm2 pam python utillinux 24 24 ]; 25 25 26 - patchPhase = '' 27 - # work around missing btrfs/version.h; otherwise, use "-DHAVE_BTRFS_VERSION_H" 28 - substituteInPlace snapper/Btrfs.cc --replace "define BTRFS_LIB_VERSION (100)" "define BTRFS_LIB_VERSION (200)"; 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" 29 36 ''; 30 37 31 - configurePhase = '' 32 - ./configure --disable-silent-rules --disable-ext4 --disable-btrfs-quota --prefix=$out 33 - ''; 38 + configureFlags = [ 39 + "--disable-ext4" # requires patched kernel & e2fsprogs 40 + ]; 34 41 35 - makeFlags = "DESTDIR=$(out)"; 42 + enableParallelBuilding = true; 36 43 37 - NIX_CFLAGS_COMPILE = [ "-I${libxml2}/include/libxml2" ]; 44 + NIX_CFLAGS_COMPILE = [ 45 + "-I${libxml2}/include/libxml2" 46 + ]; 38 47 39 - # Probably a hack, but using DESTDIR and PREFIX makes everything work! 40 48 postInstall = '' 41 - cp -r $out/$out/* $out 42 - rm -r $out/nix 43 - ''; 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 + ''; 44 59 45 60 meta = with stdenv.lib; { 46 61 description = "Tool for Linux filesystem snapshot management"; 47 62 homepage = http://snapper.io; 48 63 license = licenses.gpl2; 49 64 platforms = platforms.linux; 50 - maintainers = [ maintainers.tstrobel ]; 65 + maintainers = with maintainers; [ nckx tstrobel ]; 51 66 }; 52 67 }