bandwhich: 0.23.0 -> 0.23.1; move to by-name; nixfmt; useFetchCargoVendor (#356934)
[NixPkgs.git] / pkgs / by-name / po / pokemonsay / package.nix
blob01abfe0bfcc87944487e3fd1bbe7fae660cc3fc0
2   lib,
3   stdenvNoCC,
4   fetchFromGitHub,
5   fetchpatch,
6   cowsay,
7   coreutils,
8   findutils,
9 }:
11 stdenvNoCC.mkDerivation rec {
12   pname = "pokemonsay";
13   version = "1.0.0";
15   src = fetchFromGitHub {
16     owner = "HRKings";
17     repo = "pokemonsay-newgenerations";
18     rev = "v${version}";
19     hash = "sha256-IDTAZmOzkUg0kLUM0oWuVbi8EwE4sEpLWrNAtq/he+g=";
20   };
22   patches = [
23     (fetchpatch {
24       # https://github.com/HRKings/pokemonsay-newgenerations/pull/5
25       name = "word-wrap-fix.patch";
26       url = "https://github.com/pbsds/pokemonsay-newgenerations/commit/7056d7ba689479a8e6c14ec000be1dfcd83afeb0.patch";
27       hash = "sha256-aqUJkyJDWArLjChxLZ4BbC6XAB53LAqARzTvEAxrFCI=";
28     })
29   ];
31   postPatch = ''
32     substituteInPlace pokemonsay.sh \
33       --replace-fail \
34         'INSTALL_PATH=''${HOME}/.bin/pokemonsay' \
35         "" \
36       --replace-fail \
37         'POKEMON_PATH=''${INSTALL_PATH}/pokemons' \
38         'POKEMON_PATH=${placeholder "out"}/share/pokemonsay' \
39       --replace-fail \
40         '$(find ' \
41         '$(${findutils}/bin/find ' \
42       --replace-fail \
43         '$(basename ' \
44         '$(${coreutils}/bin/basename ' \
45       --replace-fail \
46         'cowsay -f ' \
47         '${cowsay}/bin/cowsay -f ' \
48       --replace-fail \
49         'cowthink -f ' \
50         '${cowsay}/bin/cowthink -f '
52     substituteInPlace pokemonthink.sh \
53       --replace-fail \
54         './pokemonsay.sh' \
55         "${placeholder "out"}/bin/pokemonsay"
56   '';
58   installPhase = ''
59     mkdir -p $out/{bin,share/pokemonsay}
60     cp pokemonsay.sh $out/bin/pokemonsay
61     cp pokemonthink.sh $out/bin/pokemonthink
62     cp pokemons/*.cow $out/share/pokemonsay
63   '';
65   doInstallCheck = true;
66   installCheckPhase = ''
67     (set -x
68       test "$($out/bin/pokemonsay --list | wc -l)" -ge 891
69     )
70   '';
72   meta = with lib; {
73     description = "Print pokemon in the CLI! An adaptation of the classic cowsay";
74     homepage = "https://github.com/HRKings/pokemonsay-newgenerations";
75     license = licenses.mit;
76     platforms = platforms.all;
77     maintainers = with maintainers; [ pbsds ];
78   };