Skip to content

Commit

Permalink
nicotine-plus: 1.4.1 -> unstable-2020-05-24
Browse files Browse the repository at this point in the history
Includes port to Python 3 and GTK+ 3/PyGObject; see
nicotine-plus/nicotine-plus#106 for details.

This unstable version identifies itself as 1.4.3, and is planned to be
released as 2.0.0 after it has had more fixes and testing through the
official upstream PPA. The codebase is old and flaky to begin with,
and there have been several unrelated bug fixes in the years since
the last stable release, so I think it's worth updating to be able
to use non-obsolescent versions of the core dependencies, and have
nixos-unstable users help shake out any remaining issues with the port.
I verified that searching and downloading seem to work fine.

Drop the rename of the executable to `nicotine-plus`, as the test
depends on the executable name and there doesn't seem to be any strong
reason to diverge from upstream here (the original Nicotine is long
dead). This is technically a breaking change, so it might be best to
include a symlink at `$out/bin/nicotine-plus` temporarily.
  • Loading branch information
emilazy committed May 25, 2020
1 parent db6d565 commit e7bf6a6
Showing 1 changed file with 92 additions and 20 deletions.
112 changes: 92 additions & 20 deletions pkgs/applications/networking/soulseek/nicotine-plus/default.nix
Original file line number Diff line number Diff line change
@@ -1,44 +1,116 @@
{ stdenv, fetchFromGitHub, python27Packages, geoip }:
{ lib
, stdenv
, fetchFromGitHub
, python3
, wrapGAppsHook
, gobject-introspection
, gtk3
, libnotify
, geoip

with stdenv.lib;
# Test dependencies
, xvfb_run
, gnome3
}:

python27Packages.buildPythonApplication {
python3.pkgs.buildPythonApplication {
pname = "nicotine-plus";
version = "1.4.1";
version = "unstable-2020-05-24";

src = fetchFromGitHub {
owner = "Nicotine-Plus";
repo = "nicotine-plus";
rev = "4e057d64184885c63488d4213ade3233bd33e67b";
sha256 = "11j2qm67sszfqq730czsr2zmpgkghsb50556ax1vlpm7rw3gm33c";
rev = "0f9e4e1c2391196d4070df5851ff48601aceaf7f";
hash = "sha256-kSDqoxmX9beqL98tMQylbhCZVMmQy6/oVOyW1xnxFLY=";
};

propagatedBuildInputs = with python27Packages; [
pygtk
nativeBuildInputs = [ wrapGAppsHook ];

# Avoid double-wrapping; see preFixup
# and https://nixos.org/nixpkgs/manual/#ssec-gnome-common-issues.
dontWrapGApps = true;

buildInputs = [
gobject-introspection
gtk3
libnotify
];

propagatedBuildInputs = with python3.pkgs; [
pygobject3
miniupnpc
mutagen
notify
(GeoIP.override { inherit geoip; })
];

# Insert real docs directory.
# os.getcwd() is not needed
checkInputs = [ python3.pkgs.pytest ] ++ lib.optionals (!stdenv.isDarwin) [
# The gtk3 package doesn't enable X11 on Darwin, so we can't
# use xvfb-run.
xvfb_run
python3.pkgs.robotframework
# Avoid warnings about missing icons.
gnome3.defaultIconTheme
];

# Run setup hooks for installCheckPhase;
# see https://github.com/NixOS/nixpkgs/issues/56943.
strictDeps = false;

postPatch = ''
substituteInPlace ./pynicotine/gtkgui/frame.py \
--replace "paths.append(os.getcwd())" "paths.append('"$out"/doc')"
# Remove non-free files.
sh debian/nicotine-rm-nonfree
# Find installed files in the appropriate place.
# TODO: Move to importlib_resources upstream so this can be removed.
find pynicotine -name '*.py' \
-exec sed -i "s|sys\.prefix|'$out'|g" {} +
'';

preBuild = ''
# Regenerate languages/*/LC_MESSAGES/nicotine.mo files from source.
(cd languages; python msgfmtall.py)
'';

postFixup = ''
mkdir -p $out/doc/
mv ./doc/NicotinePlusGuide $out/doc/
mv $out/bin/nicotine $out/bin/nicotine-plus
postInstall = ''
substituteInPlace $out/share/applications/nicotine.desktop \
--replace "Exec=nicotine" "Exec=$out/bin/nicotine"
'';

preFixup = ''
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
'';

installCheckPhase = ''
runHook preInstallCheck
export PATH="$out/bin:$PATH"
export HOME="$(mktemp -d)"
# These tests should be kept in sync with debian/tests/control to
# the extent possible.
nicotine --version | grep -q 'Nicotine+'
pytest test/unit
'' + lib.optionalString (!stdenv.isDarwin) ''
xvfb-run -s '-screen 0 1024x768x24' \
robot test/integration/nicotine.robot
'' + ''
runHook postInstallCheck
'';

meta = {
description = "A graphical client for the SoulSeek peer-to-peer system";
homepage = "https://www.nicotine-plus.org";
license = licenses.gpl3;
maintainers = with maintainers; [ klntsky ];
platforms = platforms.unix;
license = [
# Main license
lib.licenses.gpl3Plus
# Per sounds/default/license.txt
lib.licenses.cc0
];
maintainers = with lib.maintainers; [ klntsky emily ];
platforms = lib.platforms.unix;
};
}

0 comments on commit e7bf6a6

Please sign in to comment.