-
-
Save con-f-use/d7c569c8e3908ffa95e28dd44142f377 to your computer and use it in GitHub Desktop.
{ stdenv | |
, fetchFromGitHub | |
, python3 | |
, python3Packages | |
, wrapGAppsHook | |
, gobject-introspection | |
, gtk3 | |
, gdk-pixbuf | |
# Recommended Dependencies: | |
, unrar | |
, p7zip | |
, lhasa | |
, mupdf | |
}: | |
python3Packages.buildPythonApplication rec { | |
pname = "mcomix3"; | |
version = "20201123"; | |
# fetch from github because no official release on pypi/github and no build system | |
src = fetchFromGitHub { | |
repo = "${pname}"; | |
owner = "multiSnow"; | |
rev = "cdcb27533dc7ee2ebf7b0a8ab5ba10e61c0b8ff8"; | |
sha256 = "0q9xgl60ryf7qmy5vgzgfry4rvw5j9rb4d1ilxmpjmvm7dd3fm2k"; | |
}; | |
nativeBuildInputs = [ wrapGAppsHook ]; | |
propagatedBuildInputs = (with python3Packages; [ pillow pygobject3 pycairo ]) | |
++ [ gobject-introspection gtk3 gdk-pixbuf ] | |
++ [ unrar p7zip lhasa mupdf ]; | |
format = "other"; | |
strictDeps = false; | |
preInstall = '' | |
libdir=$out/lib/${python3.libPrefix}/site-packages | |
mkdir -p $out/share/{icons/hicolor,man/man1,applications,metainfo,thumbnailers} | |
mkdir -p $out/bin $libdir | |
''; | |
installPhase = '' | |
runHook preInstall | |
${python3.executable} installer.py --srcdir=mcomix --target=$libdir | |
mv $libdir/mcomix/mcomixstarter.py $out/bin/mcomix3 | |
mv $libdir/mcomix/comicthumb.py $out/bin/comicthump | |
mv $libdir/mcomix/mcomix/* $libdir/mcomix | |
runHook postInstall | |
''; | |
postInstall = '' | |
rmdir $libdir/mcomix/mcomix | |
cp man/* $out/share/man/man1/ | |
cp -r mime/icons/* $out/share/icons/hicolor/ | |
cp mime/*.desktop $out/share/applications/ | |
cp mime/*.appdata.xml $out/share/metainfo/ | |
cp mime/*.thumbnailer $out/share/thumbnailers/ | |
for folder in $out/share/icons/hicolor/*; do | |
mkdir $folder/{apps,mimetypes} | |
mv $folder/*.png $folder/mimetypes | |
cp $folder/mimetypes/application-x-cbt.png $folder/mimetypes/application-x-cbr.png | |
cp $folder/mimetypes/application-x-cbt.png $folder/mimetypes/application-x-cbz.png | |
done | |
''; | |
# The tests seem to be broken upstream | |
#checkInputs = [ python3Packages.pytest ]; | |
#checkPhase = '' | |
# HOME=$TMPDIR pytest | |
#''; | |
doCheck = true; | |
checkPhase = '' | |
$out/bin/comicthump --help > /dev/null | |
$out/bin/mcomix3 --help > /dev/null | |
''; | |
meta = with stdenv.lib; { | |
description = "Comic book reader and image viewer; python3 fork of mcomix"; | |
longDescription = "User-friendly, customizable image viewer, specifically designed to handle comic books and manga supporting a variety of container formats (including CBR, CBZ, CB7, CBT, LHA and PDF)"; | |
homepage = "https://github.com/multiSnow/mcomix3"; | |
changelog = "https://github.com/multiSnow/mcomix3/blob/gtk3/ChangeLog"; | |
license = licenses.gpl2Plus; | |
maintainers = with maintainers; [ confus ]; | |
platforms = platforms.all; | |
}; | |
} |
I asked about the missing gsettings schemas in the NixOS Discord, but so far no takers. Will try in discourse, too.
Edit: strictDeps = false;
as suggested in discourse seems to have done the trick. I think we can go to finalizing and then I'll make the PR @AndersonTorres, do you have any guidelines and useful tips for me regarding my first PR to nixpkgs and the cleanup of this expression? I'm trying to get the tests to work, but they might be broken upstream.
But then the wrapping for python and wrapGAppsHook is not applied to them. Or, can I the executables that should be wrapped, somehow?
Why not? The symlinks aren't wrapped at the end of day, like files themselves?
Or even, can't you create the symlinks at the fixupPhase
?
Also, "/bin/comix" is not recommended here. After all the original comix program still exists, even if abandoned. If by chance someone revives it, the names would clash.
Why not? The symlinks aren't wrapped at the end of day, like files themselves?
But the files need to be wrapped and as my understanding goes, the wrapGAppsHook
only wraps files in $out/bin/
and doesn't follow symlinks to wrapp their targets. Or am I wrong?
As far as I remember, the wrapper
- renames the file to be wrapped to something like
.fancy-file-wrapped
(the dot is to hide it from the listings); - creates a new
fancy-file
, containing a shell script that creates an environment (usually by setting relevant environment variables and options) and a call to.fancy-file-wrapped
What I am saying here is to create a symlink to (say) mcomixstarter.py
after the wrapping, with the name mcomix3 (and the same to comicthumb), instead of renaming them.
do you have any guidelines and useful tips for me regarding my first PR to nixpkgs and the cleanup of this expression?
Well, I think I already said the most of things about it, including the cosmetical ones.
I'm trying to get the tests to work, but they might be broken upstream.
Maybe it can be a bad interaction with nixpkgs. But I don't know...
But then the wrapping for python and
wrapGAppsHook
is not applied to them. Or, can I the executables that should be wrapped, somehow?Sadly not, because it creates the wrong folder structure.