nixpkgs/pkgs/applications/misc/thinking-rock/default.nix
stuebinm ff1a94e523 treewide: add meta.mainProgram to packages with a single binary
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
2024-03-19 03:14:51 +01:00

43 lines
1.3 KiB
Nix

{ lib, stdenv, fetchurl, runtimeShell }:
stdenv.mkDerivation rec {
pname = "thinkingrock-binary";
version = "2.2.1";
src = fetchurl {
url = "mirror://sourceforge/thinkingrock/ThinkingRock/TR%20${version}/tr-${version}.tar.gz";
sha256 = "0hnwvvyc8miiz8w2g4iy7s4rgfy0kfbncgbgfzpsq6nrzq334kgm";
};
/* it would be a really bad idea to put thinkingrock tr executable in PATH!
the tr.sh script does use the coreutils tr itself
That's why I've renamed the wrapper and called it thinkingrock
However you may not rename the bin/tr script cause it will notice and throw an
"java.lang.IllegalArgumentException: Malformed branding token: thinkingrock"
exception. I hope that's fine
*/
buildPhase = ''
# only keep /bin/tr
ls -1 bin/* | grep -ve 'bin/tr''$' | xargs rm
# don't keep the other .exe file either
find . -iname "*.exe" | xargs -n1 rm
mkdir -p $out/{nix-support/tr-files,bin}
cp -r . $out/nix-support/tr-files
cat >> $out/bin/thinkingrock << EOF
#!${runtimeShell}
exec $out/nix-support/tr-files/bin/tr "$@"
EOF
chmod +x $out/bin/thinkingrock
'';
dontInstall = true;
meta = with lib; {
description = "Task management system";
mainProgram = "thinkingrock";
homepage = "http://www.thinkingrock.com.au/";
license = licenses.cddl;
platforms = platforms.unix;
};
}