2022-10-16 11:27:23 +00:00
|
|
|
{ lib
|
|
|
|
, stdenvNoCC
|
|
|
|
, fetchFromGitHub
|
2022-10-24 19:22:45 +00:00
|
|
|
, fetchpatch
|
2022-10-16 11:27:23 +00:00
|
|
|
, cowsay
|
|
|
|
, coreutils
|
|
|
|
, findutils
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenvNoCC.mkDerivation rec {
|
|
|
|
pname = "pokemonsay";
|
2022-10-24 19:22:45 +00:00
|
|
|
version = "1.0.0";
|
2022-10-16 11:27:23 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "HRKings";
|
|
|
|
repo = "pokemonsay-newgenerations";
|
2022-10-24 19:22:45 +00:00
|
|
|
rev = "v${version}";
|
2022-10-16 11:27:23 +00:00
|
|
|
hash = "sha256-IDTAZmOzkUg0kLUM0oWuVbi8EwE4sEpLWrNAtq/he+g=";
|
|
|
|
};
|
|
|
|
|
2022-10-24 19:22:45 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch { # https://github.com/HRKings/pokemonsay-newgenerations/pull/5
|
|
|
|
name = "word-wrap-fix.patch";
|
|
|
|
url = "https://github.com/pbsds/pokemonsay-newgenerations/commit/7056d7ba689479a8e6c14ec000be1dfcd83afeb0.patch";
|
|
|
|
hash = "sha256-aqUJkyJDWArLjChxLZ4BbC6XAB53LAqARzTvEAxrFCI=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-10-16 11:27:23 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pokemonsay.sh \
|
2024-04-21 18:04:29 +00:00
|
|
|
--replace-fail \
|
2022-10-16 11:27:23 +00:00
|
|
|
'INSTALL_PATH=''${HOME}/.bin/pokemonsay' \
|
|
|
|
"" \
|
2024-04-21 18:04:29 +00:00
|
|
|
--replace-fail \
|
2022-10-16 11:27:23 +00:00
|
|
|
'POKEMON_PATH=''${INSTALL_PATH}/pokemons' \
|
|
|
|
'POKEMON_PATH=${placeholder "out"}/share/pokemonsay' \
|
2024-04-21 18:04:29 +00:00
|
|
|
--replace-fail \
|
2022-10-16 11:27:23 +00:00
|
|
|
'$(find ' \
|
|
|
|
'$(${findutils}/bin/find ' \
|
2024-04-21 18:04:29 +00:00
|
|
|
--replace-fail \
|
2022-10-16 11:27:23 +00:00
|
|
|
'$(basename ' \
|
|
|
|
'$(${coreutils}/bin/basename ' \
|
2024-04-21 18:04:29 +00:00
|
|
|
--replace-fail \
|
2022-10-16 11:27:23 +00:00
|
|
|
'cowsay -f ' \
|
|
|
|
'${cowsay}/bin/cowsay -f ' \
|
2024-04-21 18:04:29 +00:00
|
|
|
--replace-fail \
|
2022-10-16 11:27:23 +00:00
|
|
|
'cowthink -f ' \
|
|
|
|
'${cowsay}/bin/cowthink -f '
|
|
|
|
|
|
|
|
substituteInPlace pokemonthink.sh \
|
2024-04-21 18:04:29 +00:00
|
|
|
--replace-fail \
|
2022-10-16 11:27:23 +00:00
|
|
|
'./pokemonsay.sh' \
|
|
|
|
"${placeholder "out"}/bin/pokemonsay"
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/{bin,share/pokemonsay}
|
|
|
|
cp pokemonsay.sh $out/bin/pokemonsay
|
|
|
|
cp pokemonthink.sh $out/bin/pokemonthink
|
|
|
|
cp pokemons/*.cow $out/share/pokemonsay
|
|
|
|
'';
|
|
|
|
|
2022-10-24 19:22:45 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
(set -x
|
|
|
|
test "$($out/bin/pokemonsay --list | wc -l)" -ge 891
|
|
|
|
)
|
2022-10-16 11:27:23 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Print pokemon in the CLI! An adaptation of the classic cowsay";
|
|
|
|
homepage = "https://github.com/HRKings/pokemonsay-newgenerations";
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ pbsds ];
|
|
|
|
};
|
|
|
|
}
|