diff --git a/pkgs/tools/misc/cowsay/default.nix b/pkgs/tools/misc/cowsay/default.nix index 095c8bab48f5..87457e0a63d9 100644 --- a/pkgs/tools/misc/cowsay/default.nix +++ b/pkgs/tools/misc/cowsay/default.nix @@ -1,47 +1,47 @@ -{ lib, stdenv, perl, installShellFiles, fetchFromGitHub }: +{ lib, stdenv, perl, fetchFromGitHub, fetchpatch, nix-update-script, testers, cowsay }: stdenv.mkDerivation rec { pname = "cowsay"; - version = "3.04"; - - src = fetchFromGitHub { - owner = "tnalpgge"; - repo = "rank-amateur-cowsay"; - rev = "cowsay-${version}"; - sha256 = "sha256-9jCaQ6Um6Nl9j0/urrMCRcsGeubRN3VWD3jDM/AshRg="; - }; - - buildInputs = [ perl ]; - - nativeBuildInputs = [ installShellFiles ]; - - # overriding buildPhase because we don't want to use the install.sh script - buildPhase = '' - runHook preBuild; - substituteInPlace cowsay --replace "%BANGPERL%" "!${perl}/bin/perl" \ - --replace "%PREFIX%" "$out" - runHook postBuild; - ''; - - installPhase = '' - runHook preInstall - install -Dm755 cowsay $out/bin/cowsay - ln -s $out/bin/cowsay $out/bin/cowthink - - installManPage cowsay.1 - ln -s $man/share/man/man1/cowsay.1.gz $man/share/man/man1/cowthink.1.gz - - install -Dm644 cows/* -t $out/share/cows/ - runHook postInstall - ''; + version = "3.7.0"; outputs = [ "out" "man" ]; + src = fetchFromGitHub { + owner = "cowsay-org"; + repo = "cowsay"; + rev = "v${version}"; + hash = "sha256-t1grmCPQhRgwS64RjEwkK61F2qxxMBKuv0/DzBTnL3s="; + }; + + patches = [ + # Install cowthink as a symlink, not a copy + # See https://github.com/cowsay-org/cowsay/pull/18 + (fetchpatch { + url = "https://github.com/cowsay-org/cowsay/commit/9e129fa0933cf1837672c97f5ae5ad4a1a10ec11.patch"; + hash = "sha256-zAYEUAM5MkyMONAl5BXj8hBHRalQVAOdpxgiM+Ewmlw="; + }) + ]; + + buildInputs = [ perl ]; + + makeFlags = [ + "prefix=${placeholder "out"}" + ]; + + passthru = { + updateScript = nix-update-script { }; + tests.version = testers.testVersion { + package = cowsay; + command = "cowsay --version"; + }; + }; + meta = with lib; { description = "A program which generates ASCII pictures of a cow with a message"; - homepage = "https://github.com/tnalpgge/rank-amateur-cowsay"; + homepage = "https://cowsay.diamonds"; + changelog = "https://github.com/cowsay-org/cowsay/releases/tag/v${version}"; license = licenses.gpl3Only; platforms = platforms.all; - maintainers = [ maintainers.rob ]; + maintainers = with maintainers; [ rob anthonyroussel ]; }; }