1 { stdenv, lib, help2man, python3, fetchFromGitHub }:
3 stdenv.mkDerivation rec {
4 pname = "terminal-colors";
6 outputs = [ "out" "man" ];
8 src = fetchFromGitHub {
12 hash = "sha256-KRoP/Reo5nDKJYG9zVTVpoYL7soAGMNk46vDoaLfnv4=";
15 buildInputs = [ python3 ];
16 nativeBuildInputs = [ help2man ];
19 # This sed command modifies output of --version command in way that
20 # makes manpage generated by help2man(1) prettier.
22 sed -r -i "3s/([0-9.]+)/$pname - \1\\n/" ./$pname
24 # Upstream shebang of "terminal-colors" python script uses
25 # /usr/bin/env, which is not present in Nix sandbox, so we need to
26 # patch it before running help2man, otherwise it would fail with "no
27 # such file or directory".
29 patchShebangs ./$pname
35 help2man -n 'display terminal colors' -N ./$pname > $pname.1
43 install -D -m755 ./$pname -t $out/bin
44 install -D -m644 ./$pname.1 -t $man/share/man/man1
50 description = "Script displaying terminal colors in various formats";
51 homepage = "https://github.com/eikenb/terminal-colors";
52 license = licenses.gpl3Plus;
53 maintainers = with maintainers; [ kaction ];
54 mainProgram = "terminal-colors";