summary refs log tree commit diff
path: root/pkgs/tools/misc/ponysay/default.nix
blob: 113c2b05ff59a8d36f9283220acfc44ca830bd19 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ lib, stdenv, fetchurl, python3, texinfo, makeWrapper }:

stdenv.mkDerivation {
  name = "ponysay-3.0.3";

  src = fetchurl {
    url = "https://github.com/erkin/ponysay/archive/3.0.3.tar.gz";
    sha256 = "12mjabf5cpp5dgg63s19rlyq3dhhpzzy2sa439yncqzsk7rdg0n3";
  };

  nativeBuildInputs = [ makeWrapper ];
  buildInputs = [ python3 texinfo  ];

  inherit python3;

  phases = "unpackPhase installPhase fixupPhase";

  installPhase = ''
    find -type f -name "*.py" | xargs sed -i "s@/usr/bin/env python3@$python3/bin/python3@g"
    substituteInPlace setup.py --replace \
        "fileout.write(('#!/usr/bin/env %s\n' % env).encode('utf-8'))" \
        "fileout.write(('#!%s/bin/%s\n' % (os.environ['python3'], env)).encode('utf-8'))"
    python3 setup.py --prefix=$out --freedom=partial install \
        --with-shared-cache=$out/share/ponysay \
        --with-bash
  '';

  meta = {
    description = "Cowsay reimplemention for ponies";
    homepage = "https://github.com/erkin/ponysay";
    license = lib.licenses.gpl3;
    maintainers = with lib.maintainers; [ bodil ];
    platforms = with lib.platforms; unix;
  };
}