nixpkgs/pkgs/applications/science/math/hmetis/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

43 lines
1.1 KiB
Nix

{ lib, stdenv, fetchurl, ghostscript }:
stdenv.mkDerivation rec {
pname = "hmetis";
version = "1.5";
src = fetchurl {
url = "http://glaros.dtc.umn.edu/gkhome/fetch/sw/hmetis/hmetis-${version}-linux.tar.gz";
sha256 = "e835a098c046e9c26cecb8addfea4d18ff25214e49585ffd87038e72819be7e1";
};
nativeBuildInputs = [ ghostscript ];
binaryFiles = "hmetis khmetis shmetis";
patchPhase = ''
for binaryfile in $binaryFiles; do
patchelf \
--set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 \
--set-rpath ${stdenv.glibc}/lib \
$binaryfile
done
'';
buildPhase = ''
gs -sOutputFile=manual.pdf -sDEVICE=pdfwrite -SNOPAUSE -dBATCH manual.ps
'';
installPhase = ''
mkdir -p $out/bin $out/share/doc/hmetis $out/lib
mv $binaryFiles $out/bin
mv manual.pdf $out/share/doc/hmetis
mv libhmetis.a $out/lib
'';
meta = with lib; {
description = "hMETIS is a set of programs for partitioning hypergraphs";
homepage = "http://glaros.dtc.umn.edu/gkhome/metis/hmetis/overview";
license = licenses.unfree;
platforms = [ "i686-linux" "x86_64-linux" ];
};
}