3
0
Fork 0
forked from mirrors/nixpkgs

rsnapshot: add git version & make it configurable in the nixos module

This commit is contained in:
Aristid Breitkreuz 2014-10-27 20:38:19 +01:00
parent 3e81fe92e4
commit 93f2c180d0
3 changed files with 56 additions and 1 deletions

View file

@ -39,11 +39,20 @@ in
as retain options.
'';
};
package = mkOption {
type = types.package;
default = pkgs.rsnapshot;
example = literalExample "pkgs.rsnapshotGit";
description = ''
RSnapshot package to use.
'';
};
};
};
config = mkIf cfg.enable (let
myRsnapshot = pkgs.rsnapshot.override { configFile = rsnapshotCfg; };
myRsnapshot = cfg.package.override { configFile = rsnapshotCfg; };
rsnapshotCfg = with pkgs; writeText "gen-rsnapshot.conf" (''
config_version 1.2
cmd_cp ${coreutils}/bin/cp

View file

@ -0,0 +1,41 @@
{ fetchFromGitHub, stdenv, writeText, perl, openssh, rsync, logger,
configFile ? "/etc/rsnapshot.conf" }:
let patch = writeText "rsnapshot-config.patch" ''
--- rsnapshot-program.pl 2013-10-05 20:31:08.715991442 +0200
+++ rsnapshot-program.pl 2013-10-05 20:31:42.496193633 +0200
@@ -383,7 +383,7 @@
}
# set global variable
- $config_file = $default_config_file;
+ $config_file = '${configFile}';
}
# accepts no args
'';
in
stdenv.mkDerivation rec {
name = "rsnapshot-1.4git";
src = fetchFromGitHub {
owner = "DrHyde";
repo = "rsnapshot";
rev = "1047cbb57937c29233388e2fcd847fecd3babe74";
sha256 = "173y9q89dp4zf7nysqhjp3i2m086n7qdpawb9vx0ml5zha6mxf2p";
};
propagatedBuildInputs = [perl openssh rsync logger];
patchPhase = ''
substituteInPlace "Makefile.in" --replace \
"/usr/bin/pod2man" "${perl}/bin/pod2man"
patch -p0 <${patch}
'';
meta = with stdenv.lib; {
description = "A filesystem snapshot utility for making backups of local and remote systems";
homepage = http://rsnapshot.org/;
license = stdenv.lib.licenses.gpl2Plus;
platforms = platforms.linux;
};
}

View file

@ -2179,6 +2179,11 @@ let
# GNU Inetutils. The latter is more portable.
logger = inetutils;
};
rsnapshotGit = lowPrio (callPackage ../tools/backup/rsnapshot/git.nix {
# For the `logger' command, we can use either `utillinux' or
# GNU Inetutils. The latter is more portable.
logger = inetutils;
});
rlwrap = callPackage ../tools/misc/rlwrap { };