New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hmetis package #42745
hmetis package #42745
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the sources include a postscript manual and a user library libhmetis.a
. The library would make sense to be installed in $out/lib.
And if you feel adventurous, you could try converting the manual to a man page, info page, and/or pdf. Then install that to $out/share/{man,info,doc}/hmetis :)
{ stdenv, fetchurl, patchelf }: | ||
|
||
stdenv.mkDerivation rec { | ||
name = "hmetis-${version}-i686"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The arch shouldn't be part of the name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
name = "hmetis-${version}-i686"; | ||
version = "1.5"; | ||
|
||
buildInputs = [ patchelf ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
patchelf
is included by default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
url = "http://glaros.dtc.umn.edu/gkhome/fetch/sw/hmetis/hmetis-${version}-linux.tar.gz"; | ||
sha256 = "e835a098c046e9c26cecb8addfea4d18ff25214e49585ffd87038e72819be7e1"; | ||
}; | ||
src = [ hmetissrc ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use src = fetchurl { ...
directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
}; | ||
src = [ hmetissrc ]; | ||
|
||
doCheck = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't do anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
patchelf --set-rpath ${stdenv.glibc}/lib $out/bin/khmetis | ||
cp shmetis $out/bin/ | ||
patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 $out/bin/shmetis | ||
patchelf --set-rpath ${stdenv.glibc}/lib $out/bin/shmetis |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd think it would be more correct to put the patchelfing in patchPhase
, then do only the moving (moving would be a bit faster than copying) to $out in installPhase
. Also, you can use a for loop to not have to repeat yourself, and patchelf can take more flags at once:
for bin in hmetis khmetis shmetis; do
patchelf --set-interpreter ... \
--set-rpath ...
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Here, use this diff to also compile the manual and install the static library (removes some trailing whitespace as well): diff --git a/pkgs/applications/science/math/hmetis/default.nix b/pkgs/applications/science/math/hmetis/default.nix
index 76c98920240..9eab9ca3999 100644
--- a/pkgs/applications/science/math/hmetis/default.nix
+++ b/pkgs/applications/science/math/hmetis/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, ghostscript }:
stdenv.mkDerivation rec {
name = "hmetis-${version}";
@@ -9,10 +9,12 @@ stdenv.mkDerivation rec {
sha256 = "e835a098c046e9c26cecb8addfea4d18ff25214e49585ffd87038e72819be7e1";
};
+ nativeBuildInputs = [ ghostscript ];
+
binaryFiles = "hmetis khmetis shmetis";
patchPhase = ''
- for binaryfile in $binaryFiles; do
+ for binaryfile in $binaryFiles; do
patchelf \
--set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 \
--set-rpath ${stdenv.glibc}/lib \
@@ -20,16 +22,20 @@ stdenv.mkDerivation rec {
done
'';
+ buildPhase = ''
+ gs -sOutputFile=manual.pdf -sDEVICE=pdfwrite -SNOPAUSE -dBATCH manual.ps
+ '';
+
installPhase = ''
- mkdir -p $out/bin
- for binaryfile in $binaryFiles; do
- mv $binaryfile $out/bin
- done
+ 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 stdenv.lib; {
description = "hMETIS is a set of programs for partitioning hypergraphs";
- homepage = http://glaros.dtc.umn.edu/gkhome/metis/hmetis/overview;
+ homepage = http://glaros.dtc.umn.edu/gkhome/metis/hmetis/overview;
license = licenses.unfree;
platforms = [ "i686-linux" "x86_64-linux" ];
}; Then the only thing I see left to do is squash all commits into one. |
Now just squash all commits into one and name it "hmetis: init at 1.5" |
It's important to know how to squash commits, please look up how to do that and continue this PR here instead of opening a new one (#42843). You can ask me if you have trouble with git. |
I had such trouble that I deleted my fork and recreated it. I am not sure what to do to comply with your request, but the new fork by the same name now has one commit with everything. |
Eh alright, feel free to ask next time if you struggle with git though ;). You should close this PR then. |
Also, the one merging it could've done the squash for you. |
Motivation for this change
add hmetis package: hypergraph partitioning software needed for optimization problems
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)