I’ve installed appimage-run
via Nix config.
I’ve ran the following commands to run the appimage and I get the following output:
appimage-run OnTheSpot-0.7.1-x86_64.AppImage
OnTheSpot-0.7.1-x86_64.AppImage installed in /home/nprevail/.cache/appimage-run/7efa4941c168ae3855a30ce6a045c15a4e4e0ae02528c33acc8e54213d0589cd
Traceback (most recent call last):
File "<frozen runpy>", line 189, in _run_module_as_main
File "<frozen runpy>", line 148, in _get_module_details
File "<frozen runpy>", line 112, in _get_module_details
File "/home/nprevail/.cache/appimage-run/7efa4941c168ae3855a30ce6a045c15a4e4e0ae02528c33acc8e54213d0589cd/opt/python3.12/lib/python3.12/site-packages/onthespot/__init__.py", line 4, in <module>
from PyQt6.QtCore import QTranslator
ImportError: libzstd.so.1: cannot open shared object file: No such file or directory
I’ve followed the NixOS page on appimages: Appimage - NixOS Wiki
What seems to be the problem?
eljamm
October 12, 2024, 7:10am
2
It’s because the AppImage doesn’t bundle all the required libraries, which you can wrap using appimagetools :
onthespot-appimage.nix
{
lib,
fetchurl,
appimageTools,
}:
let
pname = "onthespot";
version = "0.7.1";
src = fetchurl {
url = "https://github.com/justin025/onthespot/releases/download/v${version}/OnTheSpot-${version}-x86_64.AppImage";
hash = "sha256-fvpJQcForjhVowzmoEXBWk5OCuAlKMM6zI5UIT0Fic0=";
};
appimageContents = appimageTools.extractType2 { inherit pname version src; };
in
appimageTools.wrapType2 {
inherit pname version src;
profile = ''
# Unset wrapped QT plugins since they're already include as mixing QT
# versions resuls in a conflict
unset QT_PLUGIN_PATH
'';
extraInstallCommands = ''
install -m 444 -D ${appimageContents}/org.onthespot.OnTheSpot.desktop -t $out/share/applications
install -m 444 -D ${appimageContents}/onthespot.png -t $out/share/icons/hicolor/512x512/apps
substituteInPlace $out/share/applications/org.onthespot.OnTheSpot.desktop \
--replace-fail 'Exec=python3 -m onthespot' 'Exec=onthespot'
'';
extraPkgs = pkgs: [
pkgs.zstd
];
meta = {
description = "QT based Spotify music downloader written in Python";
homepage = "https://github.com/casualsnek/onthespot";
changelog = "https://github.com/casualsnek/onthespot/releases/tag/v${version}";
license = lib.licenses.gpl2Only;
platforms = lib.platforms.linux;
mainProgram = "onthespot";
};
}
However, since the original onthespot
is already in nixpkgs, you can also override it to use the new fork:
environment.systemPackages = [
(pkgs.callPackage ./onthespot.nix { })
];
onthespot.nix
{
lib,
fetchFromGitHub,
copyDesktopItems,
makeDesktopItem,
python3,
ffmpeg,
qt6,
}:
python3.pkgs.buildPythonApplication rec {
pname = "onthespot";
version = "0.7.1";
pyproject = true;
src = fetchFromGitHub {
owner = "justin025";
repo = "onthespot";
rev = "refs/tags/v${version}";
hash = "sha256-G4c1u7HvTap6iZ2ttGBxhRpYrdICIGXwfgo7Jbmq/R4=";
};
pythonRemoveDeps = [
"PyQt6-Qt6"
"PyQt6-stubs"
# Doesn't seem to be used in the sources and causes
# build issues
"PyOgg"
];
pythonRelaxDeps = true;
nativeBuildInputs = [
copyDesktopItems
qt6.wrapQtAppsHook
];
dependencies = with python3.pkgs; [
async-timeout
charset-normalizer
defusedxml
ffmpeg
librespot
music-tag
packaging
pillow
protobuf
pyperclip
pyqt6
pyqt6-sip
pyxdg
qt6.qtbase
requests
setuptools
show-in-file-manager
urllib3
zeroconf
];
postInstall = ''
install -Dm444 \
$src/src/onthespot/resources/icons/onthespot.png \
$out/share/icons/hicolor/256x256/apps/onthespot.png
'';
preFixup = ''
makeWrapperArgs+=("''${qtWrapperArgs[@]}")
'';
desktopItems = [
(makeDesktopItem {
name = "Onthespot";
exec = "onthespot_gui";
icon = "onthespot";
desktopName = "Onthespot";
comment = meta.description;
categories = [ "Audio" ];
})
];
meta = {
description = "QT based Spotify music downloader written in Python";
homepage = "https://github.com/casualsnek/onthespot";
changelog = "https://github.com/casualsnek/onthespot/releases/tag/v${version}";
license = lib.licenses.gpl2Only;
maintainers = with lib.maintainers; [ onny ];
platforms = lib.platforms.linux;
mainProgram = "onthespot_gui";
};
}
0.7.1-diff.patch
---
pkgs/by-name/on/onthespot/package.nix | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/pkgs/by-name/on/onthespot/package.nix b/pkgs/by-name/on/onthespot/package.nix
index ebda24f08696..616f1b150d79 100644
--- a/pkgs/by-name/on/onthespot/package.nix
+++ b/pkgs/by-name/on/onthespot/package.nix
@@ -1,28 +1,28 @@
{
lib,
- copyDesktopItems,
fetchFromGitHub,
+ copyDesktopItems,
makeDesktopItem,
python3,
- libsForQt5,
ffmpeg,
+ qt6,
}:
python3.pkgs.buildPythonApplication rec {
pname = "onthespot";
- version = "0.5";
+ version = "0.7.1";
pyproject = true;
src = fetchFromGitHub {
- owner = "casualsnek";
+ owner = "justin025";
repo = "onthespot";
rev = "refs/tags/v${version}";
- hash = "sha256-VaJBNsT7uNOGY43GnzhUqDQNiPoFZcc2UaIfOKgkufg=";
+ hash = "sha256-G4c1u7HvTap6iZ2ttGBxhRpYrdICIGXwfgo7Jbmq/R4=";
};
pythonRemoveDeps = [
- "PyQt5-Qt5"
- "PyQt5-stubs"
+ "PyQt6-Qt6"
+ "PyQt6-stubs"
# Doesn't seem to be used in the sources and causes
# build issues
"PyOgg"
@@ -30,9 +30,9 @@ python3.pkgs.buildPythonApplication rec {
pythonRelaxDeps = true;
- nativeBuildInputs = with python3.pkgs; [
+ nativeBuildInputs = [
copyDesktopItems
- libsForQt5.wrapQtAppsHook
+ qt6.wrapQtAppsHook
];
dependencies = with python3.pkgs; [
@@ -45,9 +45,11 @@ python3.pkgs.buildPythonApplication rec {
packaging
pillow
protobuf
- pyqt5
- pyqt5-sip
+ pyperclip
+ pyqt6
+ pyqt6-sip
pyxdg
+ qt6.qtbase
requests
setuptools
show-in-file-manager
@@ -56,7 +58,7 @@ python3.pkgs.buildPythonApplication rec {
];
postInstall = ''
- install -Dm444 $src/src/onthespot/resources/icon.png $out/share/icons/hicolor/256x256/apps/onthespot.png
+ install -Dm444 $src/src/onthespot/resources/icons/onthespot.png $out/share/icons/hicolor/256x256/apps/onthespot.png
'';
preFixup = ''
--
2.46.0
Nice, thanks. Someone should get this into nixpkgs. Version 0.5 is pretty much useless.
Atemu
October 24, 2024, 9:33am
4
That someone could be you