1{ lib, stdenv, fetchFromGitHub, cmake, libuuid, gnutls, python3, xdg-utils, installShellFiles }:
2
3stdenv.mkDerivation rec {
4 pname = "taskwarrior";
5 version = "2.6.2";
6
7 src = fetchFromGitHub {
8 owner = "GothenburgBitFactory";
9 repo = "taskwarrior";
10 rev = "v${version}";
11 sha256 = "sha256-0YveqiylXJi4cdDCfnPtwCVOJbQrZYsxnXES+9B4Yfw=";
12 fetchSubmodules = true;
13 };
14
15 postPatch = ''
16 substituteInPlace src/commands/CmdNews.cpp \
17 --replace "xdg-open" "${lib.getBin xdg-utils}/bin/xdg-open"
18 '';
19
20 nativeBuildInputs = [ cmake libuuid gnutls python3 installShellFiles ];
21
22 doCheck = true;
23 preCheck = ''
24 patchShebangs --build test
25 '';
26 checkTarget = "test";
27
28 postInstall = ''
29 # ZSH is installed automatically from some reason, only bash and fish need
30 # manual installation
31 installShellCompletion --cmd task \
32 --bash $out/share/doc/task/scripts/bash/task.sh \
33 --fish $out/share/doc/task/scripts/fish/task.fish
34 rm -r $out/share/doc/task/scripts/bash
35 rm -r $out/share/doc/task/scripts/fish
36 # Install vim and neovim plugin
37 mkdir -p $out/share/vim-plugins
38 mv $out/share/doc/task/scripts/vim $out/share/vim-plugins/task
39 mkdir -p $out/share/nvim
40 ln -s $out/share/vim-plugins/task $out/share/nvim/site
41 '';
42
43 meta = with lib; {
44 description = "Highly flexible command-line tool to manage TODO lists";
45 homepage = "https://taskwarrior.org";
46 license = licenses.mit;
47 maintainers = with maintainers; [ marcweber oxalica ];
48 mainProgram = "task";
49 platforms = platforms.unix;
50 };
51}