depot/third_party/nixpkgs/pkgs/by-name/ta/taskwarrior3/package.nix
Luke Granger-Brown f92e137cfb
Some checks failed
/ combine-systems (push) Blocked by required conditions
/ build (x86_64-linux) (push) Failing after 11m44s
/ build (aarch64-linux) (push) Failing after 11m50s
/ build (push) Failing after 16m42s
Merge commit '1e2ed035f4bebc9adad02b365508ad96f7df87c1' into HEAD
2025-03-02 02:23:32 +00:00

135 lines
3.7 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
# nativeBuildInputs
cmake,
rustPlatform,
rustc,
cargo,
installShellFiles,
# buildInputs
libuuid,
xdg-utils,
# passthru.tests
nixosTests,
# nativeCheckInputs
python3,
# nativeInstallCheckInputs
versionCheckHook,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "taskwarrior";
version = "3.3.0";
src = fetchFromGitHub {
owner = "GothenburgBitFactory";
repo = "taskwarrior";
rev = "v${finalAttrs.version}";
hash = "sha256-aKDwRCJ1yopRdsPxnHhgOpSho1i8/dcAurI+XhpSbn4=";
fetchSubmodules = true;
};
cargoDeps = rustPlatform.fetchCargoVendor {
name = "${finalAttrs.pname}-${finalAttrs.version}-cargo-deps";
inherit (finalAttrs) src;
hash = "sha256-UbJodQBCrmXbw5+ahusBnEcoCYGFHRA6bg5hf9/prmA=";
};
postPatch = ''
substituteInPlace src/commands/CmdNews.cpp \
--replace-fail "xdg-open" "${lib.getBin xdg-utils}/bin/xdg-open"
'';
# The CMakeLists files used by upstream issue a `cargo install` command to
# install a rust tool (cxxbridge-cmd) that is supposed to be included in the Cargo.toml's and
# `Cargo.lock` files of upstream. Setting CARGO_HOME like that helps `cargo
# install` find the dependencies we prefetched. See also:
# https://github.com/GothenburgBitFactory/taskwarrior/issues/3705
postUnpack = ''
export CARGO_HOME=$PWD/.cargo
'';
failingTests = [
# It would be very hard to make this test succeed, as the bash completion
# needs to be installed and the builder's `bash` should be aware of it.
# Doesn't worth the effort. See also:
# https://github.com/GothenburgBitFactory/taskwarrior/issues/3727
"bash_completion.test.py"
];
# Contains Bash and Python scripts used while testing.
preConfigure =
''
patchShebangs test
''
+ lib.optionalString (builtins.length finalAttrs.failingTests > 0) ''
substituteInPlace test/CMakeLists.txt \
${lib.concatMapStringsSep "\\\n " (t: "--replace-fail ${t} '' ") finalAttrs.failingTests}
'';
strictDeps = true;
nativeBuildInputs = [
cmake
rustPlatform.cargoSetupHook
# To install cxxbridge-cmd before configurePhase, see above linked upstream
# issue.
rustc
cargo
installShellFiles
];
buildInputs = [
libuuid
];
doCheck = true;
# See:
# https://github.com/GothenburgBitFactory/taskwarrior/blob/v3.2.0/doc/devel/contrib/development.md#run-the-test-suite
preCheck = ''
make test_runner
'';
nativeCheckInputs = [
python3
];
doInstallCheck = true;
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgram = "${placeholder "out"}/bin/${finalAttrs.meta.mainProgram}";
postInstall = ''
# ZSH is installed automatically from some reason, only bash and fish need
# manual installation
installShellCompletion --cmd task \
--bash $out/share/doc/task/scripts/bash/task.sh \
--fish $out/share/doc/task/scripts/fish/task.fish
rm -r $out/share/doc/task/scripts/bash
rm -r $out/share/doc/task/scripts/fish
# Install vim and neovim plugin
mkdir -p $out/share/vim-plugins
mv $out/share/doc/task/scripts/vim $out/share/vim-plugins/task
mkdir -p $out/share/nvim
ln -s $out/share/vim-plugins/task $out/share/nvim/site
'';
passthru.tests.nixos = nixosTests.taskchampion-sync-server;
meta = {
changelog = "https://github.com/GothenburgBitFactory/taskwarrior/releases/tag/v${finalAttrs.src.rev}";
description = "Highly flexible command-line tool to manage TODO lists";
homepage = "https://taskwarrior.org";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
marcweber
oxalica
mlaradji
doronbehar
];
mainProgram = "task";
platforms = lib.platforms.unix;
};
})