nixpkgs/pkgs/by-name/ta/taskwarrior3/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

96 lines
2.4 KiB
Nix

{
rustPlatform,
rustc,
cargo,
corrosion,
lib,
stdenv,
fetchFromGitHub,
cmake,
libuuid,
nixosTests,
python3,
xdg-utils,
installShellFiles,
darwin,
}:
stdenv.mkDerivation rec {
pname = "taskwarrior";
version = "3.1.0";
src = fetchFromGitHub {
owner = "GothenburgBitFactory";
repo = "taskwarrior";
rev = "v${version}";
hash = "sha256-iKpOExj1xM9rU/rIcOLLKMrZrAfz7y9X2kt2CjfMOOQ=";
fetchSubmodules = true;
};
postPatch = ''
substituteInPlace src/commands/CmdNews.cpp \
--replace "xdg-open" "${lib.getBin xdg-utils}/bin/xdg-open"
'';
nativeBuildInputs =
[
cmake
libuuid
python3
installShellFiles
corrosion
cargo
rustc
rustPlatform.cargoSetupHook
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# darwin dependencies
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
];
doCheck = true;
checkTarget = "build_tests";
cargoDeps = rustPlatform.fetchCargoTarball {
name = "${pname}-${version}-cargo-deps";
inherit src;
sourceRoot = src.name;
hash = "sha256-L+hYYKXSOG4XYdexLMG3wdA7st+A9Wk9muzipSNjxrA=";
};
cargoRoot = "./";
preConfigure = ''
export CMAKE_PREFIX_PATH="${corrosion}:$CMAKE_PREFIX_PATH"
'';
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/blob/${src.rev}/ChangeLog";
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;
};
}