about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeder Bergebakken Sundt <pbsds@hotmail.com>2022-10-16 13:27:23 +0200
committerehmry <ehmry@posteo.net>2022-10-16 16:51:55 -0500
commit37447aa7af95e660d323123ba355e1c91a804cb9 (patch)
tree4e71e29562576c9786e9de3c5ac703d5fb50b193
parent8527fb88b57d190d1e341c25d4c2e30d17e163a2 (diff)
pokemonsay: init at unstable-2021-10-05
-rw-r--r--pkgs/tools/misc/pokemonsay/default.nix65
-rw-r--r--pkgs/top-level/all-packages.nix2
2 files changed, 67 insertions, 0 deletions
diff --git a/pkgs/tools/misc/pokemonsay/default.nix b/pkgs/tools/misc/pokemonsay/default.nix
new file mode 100644
index 0000000000000..f61b93a874f22
--- /dev/null
+++ b/pkgs/tools/misc/pokemonsay/default.nix
@@ -0,0 +1,65 @@
+{ lib
+, stdenvNoCC
+, fetchFromGitHub
+, cowsay
+, coreutils
+, findutils
+}:
+
+stdenvNoCC.mkDerivation rec {
+  pname = "pokemonsay";
+  version = "unstable-2021-10-05";
+
+  src = fetchFromGitHub {
+    owner = "HRKings";
+    repo = "pokemonsay-newgenerations";
+    rev = "baccc6d2fe1897c48f60d82ff9c4d4c018f5b594";
+    hash = "sha256-IDTAZmOzkUg0kLUM0oWuVbi8EwE4sEpLWrNAtq/he+g=";
+  };
+
+  postPatch = ''
+    substituteInPlace pokemonsay.sh \
+      --replace \
+        'INSTALL_PATH=''${HOME}/.bin/pokemonsay' \
+        "" \
+      --replace \
+        'POKEMON_PATH=''${INSTALL_PATH}/pokemons' \
+        'POKEMON_PATH=${placeholder "out"}/share/pokemonsay' \
+      --replace \
+        '$(find ' \
+        '$(${findutils}/bin/find ' \
+      --replace \
+        '$(basename ' \
+        '$(${coreutils}/bin/basename ' \
+      --replace \
+        'cowsay -f ' \
+        '${cowsay}/bin/cowsay -f ' \
+      --replace \
+        'cowthink -f ' \
+        '${cowsay}/bin/cowthink -f '
+
+    substituteInPlace pokemonthink.sh \
+      --replace \
+        './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
+  '';
+
+  checkPhase = ''
+    $out/bin/pokemonsay --list-pokemon
+  '';
+
+  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 ];
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index ebacd3760105b..59ac04d248802 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -30952,6 +30952,8 @@ with pkgs;
 
   poke = callPackage ../applications/editors/poke { };
 
+  pokemonsay = callPackage ../tools/misc/pokemonsay { };
+
   polar-bookshelf = callPackage ../applications/misc/polar-bookshelf { };
 
   poezio = python3Packages.poezio;