2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub
|
2021-02-05 17:12:51 +00:00
|
|
|
, autoreconfHook, pkg-config, docbook_xsl, libxslt, docbook_xml_dtd_45
|
2023-11-16 04:20:00 +00:00
|
|
|
, acl, attr, boost, btrfs-progs, coreutils, dbus, diffutils, e2fsprogs, libxml2
|
2022-04-27 09:35:20 +00:00
|
|
|
, lvm2, pam, util-linux, json_c, nixosTests
|
2021-01-05 17:05:55 +00:00
|
|
|
, ncurses }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "snapper";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "0.11.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openSUSE";
|
|
|
|
repo = "snapper";
|
|
|
|
rev = "v${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
sha256 = "sha256-7FwjVk3kkC/suJ13BIEEfIswsPBYhdQI1IuPvNcXi4A=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [
|
2021-02-05 17:12:51 +00:00
|
|
|
autoreconfHook pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
docbook_xsl libxslt docbook_xml_dtd_45
|
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
acl attr boost btrfs-progs dbus diffutils e2fsprogs libxml2
|
2022-04-27 09:35:20 +00:00
|
|
|
lvm2 pam util-linux json_c ncurses
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
passthru.tests.snapper = nixosTests.snapper;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
# Hard-coded root paths, hard-coded root paths everywhere...
|
|
|
|
for file in {client,data,pam,scripts,zypp-plugin}/Makefile.am; do
|
|
|
|
substituteInPlace $file \
|
|
|
|
--replace '$(DESTDIR)/usr' "$out" \
|
|
|
|
--replace "DESTDIR" "out" \
|
|
|
|
--replace "/usr" "$out"
|
|
|
|
done
|
|
|
|
substituteInPlace pam/Makefile.am \
|
|
|
|
--replace '/`basename $(libdir)`' "$out/lib"
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--disable-ext4" # requires patched kernel & e2fsprogs
|
2023-11-16 04:20:00 +00:00
|
|
|
"DIFFBIN=${diffutils}/bin/diff"
|
|
|
|
"RMBIN=${coreutils}/bin/rm"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
rm -r $out/etc/cron.*
|
|
|
|
patchShebangs $out/lib/zypp/plugins/commit/*
|
|
|
|
for file in \
|
|
|
|
$out/lib/pam_snapper/* \
|
|
|
|
$out/lib/systemd/system/* \
|
|
|
|
$out/share/dbus-1/system-services/* \
|
|
|
|
; do
|
|
|
|
substituteInPlace $file --replace "/usr" "$out"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Tool for Linux filesystem snapshot management";
|
|
|
|
homepage = "http://snapper.io";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = licenses.gpl2Only;
|
2023-08-22 20:05:09 +00:00
|
|
|
mainProgram = "snapper";
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with maintainers; [ markuskowa ];
|
2023-08-22 20:05:09 +00:00
|
|
|
platforms = platforms.linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|