1{ lib, stdenv, fetchurl, openssl, zlib, e2fsprogs, bash, bzip2 }:
2
3let
4 zshCompletion = fetchurl {
5 url = "https://gist.githubusercontent.com/thoughtpolice/daa9431044883d3896f6/raw/282360677007db9739e5bf229873d3b231eb303a/tarsnap.zsh";
6 sha256 = "0pawqwichzpz29rva7mh8lpx4zznnrh2rqyzzj6h7z98l0dxpair";
7 };
8in
9stdenv.mkDerivation rec {
10 pname = "tarsnap";
11 version = "1.0.40";
12
13 src = fetchurl {
14 url = "https://www.tarsnap.com/download/tarsnap-autoconf-${version}.tgz";
15 sha256 = "1mbzq81l4my5wdhyxyma04sblr43m8p7ryycbpi6n78w1hwfbjmw";
16 };
17
18 preConfigure = ''
19 configureFlags="--with-bash-completion-dir=$out/share/bash-completion/completions"
20 '';
21
22 patchPhase = ''
23 substituteInPlace Makefile.in \
24 --replace "command -p mv" "mv"
25 substituteInPlace configure \
26 --replace "command -p getconf PATH" "echo $PATH"
27 '';
28
29 postInstall = ''
30 # Install some handy-dandy shell completions
31 install -m 444 -D ${zshCompletion} $out/share/zsh/site-functions/_tarsnap
32 '';
33
34 buildInputs = [ openssl zlib ] ++ lib.optional stdenv.isLinux e2fsprogs
35 ++ lib.optional stdenv.isDarwin bzip2;
36
37 meta = {
38 description = "Online backups for the truly paranoid";
39 homepage = "http://www.tarsnap.com/";
40 license = lib.licenses.unfree;
41 platforms = lib.platforms.unix;
42 maintainers = with lib.maintainers; [ thoughtpolice roconnor ];
43 };
44}