nixpkgs/pkgs/by-name/no/noweb/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

87 lines
2.5 KiB
Nix

{ lib, stdenv, fetchFromGitHub, nawk, groff, icon-lang, useIcon ? true }:
stdenv.mkDerivation (finalAttrs: {
pname = "noweb";
version = "2.13";
src = fetchFromGitHub {
owner = "nrnrnr";
repo = "noweb";
rev = "v${builtins.replaceStrings ["."] ["_"] finalAttrs.version}";
sha256 = "sha256-COcWyrYkheRaSr2gqreRRsz9SYRTX2PSl7km+g98ljs=";
};
sourceRoot = "${finalAttrs.src.name}/src";
patches = [
# Remove FAQ
./no-FAQ.patch
];
postPatch = ''
substituteInPlace Makefile --replace 'strip' '${stdenv.cc.targetPrefix}strip'
substituteInPlace Makefile --replace '`./gitversion`' '${finalAttrs.src.rev}'
'';
nativeBuildInputs = [ groff ] ++ lib.optionals useIcon [ icon-lang ];
buildInputs = [ nawk ];
preBuild = ''
mkdir -p "$out/lib/noweb"
'';
makeFlags = lib.optionals useIcon [
"LIBSRC=icon"
"ICONC=icont"
] ++ [ "CC=${stdenv.cc.targetPrefix}cc" ];
preInstall = ''
mkdir -p "$tex/tex/latex/noweb"
installFlagsArray+=( \
"BIN=${placeholder "out"}/bin" \
"ELISP=${placeholder "out"}/share/emacs/site-lisp" \
"LIB=${placeholder "out"}/lib/noweb" \
"MAN=${placeholder "out"}/share/man" \
"TEXINPUTS=${placeholder "tex"}/tex/latex/noweb" \
)
'';
installTargets = [ "install-code" "install-tex" "install-elisp" ];
postInstall = ''
substituteInPlace "$out/bin/cpif" --replace "PATH=/bin:/usr/bin" ""
for f in $out/bin/no{index,roff,roots,untangle,web} \
$out/lib/noweb/to{ascii,html,roff,tex} \
$out/lib/noweb/{bt,empty}defn \
$out/lib/noweb/{noidx,pipedocs,unmarkup}; do
# NOTE: substituteInPlace breaks Icon binaries, so make sure the script
# uses (n)awk before calling.
if grep -q nawk "$f"; then
substituteInPlace "$f" --replace "nawk" "${nawk}/bin/nawk"
fi
done
# HACK: This is ugly, but functional.
PATH=$out/bin:$PATH make -BC xdoc
make "''${installFlagsArray[@]}" install-man
ln -s "$tex" "$out/share/texmf"
'';
outputs = [ "out" "tex" ];
passthru = {
tlType = "run";
pkgs = [ finalAttrs.finalPackage.tex ];
};
meta = with lib; {
description = "Simple, extensible literate-programming tool";
homepage = "https://www.cs.tufts.edu/~nr/noweb";
license = licenses.bsd2;
maintainers = with maintainers; [ yurrriq ];
platforms = with platforms; linux ++ darwin;
};
})