diff options
author | éclairevoyant <848000+eclairevoyant@users.noreply.github.com> | 2024-03-19 19:47:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-19 19:47:16 +0000 |
commit | 516de99140942fe07decc8bd25b63c9d9a3304e8 (patch) | |
tree | 7919ecfd5f9346e582583d9fba8afb0834fc062c | |
parent | 45838d1d5021f8b55222ac715dfeef45c557349b (diff) | |
parent | f15d9c9c1e405fa4e9810b1088e41e5db0c0f2f3 (diff) |
Merge pull request #292494 from jtbx/chawan
chawan: init at 0-unstable-2024-03-01
-rw-r--r-- | pkgs/by-name/ch/chawan/mancha-augment-path.diff | 15 | ||||
-rw-r--r-- | pkgs/by-name/ch/chawan/package.nix | 76 |
2 files changed, 91 insertions, 0 deletions
diff --git a/pkgs/by-name/ch/chawan/mancha-augment-path.diff b/pkgs/by-name/ch/chawan/mancha-augment-path.diff new file mode 100644 index 0000000000000..cbe4f6aed80ed --- /dev/null +++ b/pkgs/by-name/ch/chawan/mancha-augment-path.diff @@ -0,0 +1,15 @@ +Add the -m option to man's command line to augment the list of paths +searched by man. The string "OUT" must be substituted with chawan's $out +path after patching. +The required -m option is only available in the mandoc implementation. +--- a/adapter/protocol/man ++++ b/adapter/protocol/man +@@ -75,7 +75,7 @@ EOF + + $section =~ s:([^-\w\200-\377.,])::g; + $man =~ s:([^-\w\200-\377.,])::g; +- open(F, "GROFF_NO_SGR=1 MAN_KEEP_FORMATTING=1 $MAN $section $man 2> /dev/null |"); ++ open(F, "GROFF_NO_SGR=1 MAN_KEEP_FORMATTING=1 $MAN -m OUT/share/man $section $man 2> /dev/null |"); + } + + $ok = 0; diff --git a/pkgs/by-name/ch/chawan/package.nix b/pkgs/by-name/ch/chawan/package.nix new file mode 100644 index 0000000000000..4a52e998fc7ce --- /dev/null +++ b/pkgs/by-name/ch/chawan/package.nix @@ -0,0 +1,76 @@ +{ lib +, stdenv +, fetchFromSourcehut +, makeBinaryWrapper +, curlMinimal +, mandoc +, ncurses +, nim +, pandoc +, perl +, pkg-config +, zlib +}: + +stdenv.mkDerivation { + pname = "chawan"; + version = "0-unstable-2024-03-01"; + + src = fetchFromSourcehut { + owner = "~bptato"; + repo = "chawan"; + rev = "87ba9a87be15abbe06837f1519cfb76f4bf759f3"; + hash = "sha256-Xs+Mxe5/uoxPMf4FuelpO+bRJ1KdfASVI7rWqtboJZw="; + fetchSubmodules = true; + }; + + patches = [ + # Include chawan's man pages in mancha's search path + ./mancha-augment-path.diff + ]; + + env.NIX_CFLAGS_COMPILE = toString ( + lib.optional stdenv.cc.isClang "-Wno-error=implicit-function-declaration" + ); + + buildInputs = [ curlMinimal ncurses perl zlib ]; + nativeBuildInputs = [ + makeBinaryWrapper + nim + pandoc + pkg-config + ]; + + postPatch = '' + substituteInPlace adapter/protocol/man \ + --replace-fail "OUT" $out + ''; + + buildFlags = [ "all" "manpage" ]; + installFlags = [ + "DESTDIR=$(out)" + "PREFIX=/" + ]; + + postInstall = + let + makeWrapperArgs = '' + --set MANCHA_CHA $out/bin/cha \ + --set MANCHA_MAN ${mandoc}/bin/man + ''; + in + '' + wrapProgram $out/bin/cha ${makeWrapperArgs} + wrapProgram $out/bin/mancha ${makeWrapperArgs} + ''; + + meta = { + description = "Lightweight and featureful terminal web browser"; + homepage = "https://sr.ht/~bptato/chawan/"; + license = lib.licenses.publicDomain; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ jtbx ]; + mainProgram = "cha"; + broken = stdenv.isDarwin; # pending PR #292043 + }; +} |