1 { lib, stdenv, fetchFromGitHub, ruby, bash, ncurses }:
3 rubyEnv = ruby.withPackages (ps: with ps; [ ansi ]);
5 stdenv.mkDerivation rec {
9 src = fetchFromGitHub {
10 owner = "globalcitizen";
13 hash = "sha256-axMpQICvxWBlNJ5D06DYI7b4zFGeadfWFcpTN6lPvpg=";
16 buildInputs = [ rubyEnv bash ncurses ];
19 # Pre-create a cache within this derivation
21 # Remove the need to test for `tput`, depend on ncurses directly
23 # Fix the script name in `taoup --help` output
28 substituteInPlace taoup \
29 --subst-var-by ncurses ${ncurses} \
30 --subst-var-by pname ${pname}
31 substituteInPlace taoup-fortune \
32 --subst-var-by out $out \
33 --replace "/bin/bash" "${bash}/bin/bash"
42 mkdir -p $out/{bin,lib/taoup}
44 cp taoup $out/lib/taoup
45 cat > $out/bin/taoup <<EOF
47 exec ${rubyEnv}/bin/ruby "$out/lib/taoup/taoup" "\$@"
49 chmod +x $out/bin/taoup
51 # Populate the cache created by cachedir.patch above
52 $out/bin/taoup > $out/lib/taoup/cache
54 cp taoup-fortune $out/bin
55 chmod +x $out/bin/taoup-fortune
61 description = "The Tao of Unix Programming (Ruby-powered ANSI colored fortunes)";
62 homepage = "https://github.com/globalcitizen/taoup";
63 license = lib.licenses.gpl3Only;
64 maintainers = [ lib.maintainers.zakame ];