summary refs log tree commit diff
path: root/pkgs/servers/misc/taskserver/default.nix
blob: 466c3873c600464b20aed6096fc43ea323297fd0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ stdenv, fetchurl, cmake, libuuid, gnutls, makeWrapper }:

stdenv.mkDerivation rec {
  name = "taskserver-${version}";
  version = "1.1.0";

  enableParallelBuilding = true;

  src = fetchurl {
    url = "http://www.taskwarrior.org/download/taskd-${version}.tar.gz";
    sha256 = "1d110q9vw8g5syzihxymik7hd27z1592wkpz55kya6lphzk8i13v";
  };

  patchPhase = ''
    pkipath=$out/share/taskd/pki
    mkdir -p $pkipath
    cp -r pki/* $pkipath
    echo "patching paths in pki/generate"
    sed -i "s#^\.#$pkipath#" $pkipath/generate
    for f in $pkipath/generate* ;do
      i=$(basename $f)
      echo patching $i
      sed -i \
          -e 's/which/type -p/g' \
          -e 's#^\. ./vars#if test -e ./vars;then . ./vars; else echo "cannot find ./vars - copy the template from '$pkipath'/vars into the working directory";exit 1; fi#' $f

      echo wrapping $i
      makeWrapper  $pkipath/$i $out/bin/taskd-pki-$i \
        --prefix PATH : ${stdenv.lib.makeBinPath [ gnutls ]}
    done
  '';

  buildInputs = [ makeWrapper ];
  nativeBuildInputs = [ cmake libuuid gnutls ];

  meta = {
    description = "Server for synchronising Taskwarrior clients";
    homepage = http://taskwarrior.org;
    license = stdenv.lib.licenses.mit;
    platforms = stdenv.lib.platforms.linux;
    maintainers = with stdenv.lib.maintainers; [ makefu ];
  };
}