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
pHash: init at 0.9.4 #42546
pHash: init at 0.9.4 #42546
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.
ah I've been meaning to try this library, thanks! I have a few changes to suggest.
maintainers/maintainer-list.nix
Outdated
@@ -1717,6 +1717,11 @@ | |||
github = "ilya-kolpakov"; | |||
name = "Ilya Kolpakov"; | |||
}; | |||
imalsogreg = { |
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.
Welcome!
Needs rebase.
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.
:)
src = fetchFromGitHub { | ||
owner = "clearscene"; | ||
repo = "pHash"; | ||
rev = "0.9.4"; |
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.
rev = version
|
||
meta = { | ||
inherit version; | ||
description = ''Compute the perceptual hash of an image''; |
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.
nit: '' ''
is for multi-line string, you can just use "Compute the perceptual hash of an image"
here
sha256 = "0y4gknfkns5sssfaj0snyx29752my20xmxajg6xggijx0myabbv0"; | ||
}; | ||
|
||
meta = { |
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.
style nit: common pattern is to do:
meta = with stdenv.lib; { }
so you don't have to fully qualify everything in the meta
@jb55 Thank you for the pointers! I've made those changes and rebased on master. |
meta = with stdenv.lib; { | ||
inherit version; | ||
description = "Compute the perceptual hash of an image"; | ||
license = icenses.gpl3; |
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.
oops: icenses
-> licenses
Fix style and redundancy issues pointed out by @jb55
@jb55 Hah, how embarrassing. I assumed the meta fields are checked by |
@GrahamcOfBorg build phash |
Success on x86_64-linux (full log) Attempted: phash Partial log (click to expand)
|
Success on x86_64-darwin (full log) Attempted: phash Partial log (click to expand)
|
Success on aarch64-linux (full log) Attempted: phash Partial log (click to expand)
|
Thank you! |
Motivation for this change
pHash
is a useful c library with several small quirks in its build process and increasing numbers of workarounds for building on other systems.We also have
phash
Haskell bindings innixpkgs
which is broken due to lack of packaging of the c library.Things done
NixOS, or option
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
) (N/A)nix path-info -S
before and after)Additional testing
C
Wrote a small c program depending on
pHash
which passes a CLI argument to the library and prints the hash. This works on NixOS and Darwin.Haskell
The
phash
Haskell library with modifications to the cabal file, to usepkgconfig-depends
field. This doesn't quite work out of the box, for reasons I am still trying to understand (and which may be due to problems withpHash
, my nix packaging,cabal
, orpkg-config
, or any combination of the above). I can get the library to compile only if I add a second fakepkg-config
dependency (I choselibzmq
randomly). With two entries inpkgconfig-depends
field, thephash
bindings can successfully hash an image from a filepath. However when using only the true dependency,configure
phase fails: