nixpkgs/pkgs/by-name/mo/monophony/package.nix
Yueh-Shun Li 91b3db1309 treewide: fix sourceRoot for fetchgit-based src
According to Nixpkgs manual[1] and NixOS 23.11 Release Note[2], the
`sourceRoot` attribute passed to `stdenv.mkDerivation` should be
specified as `"${src.name}"` or `"${src.name}/subdir"` when `src` is
produced using `fetchgit`-based fetchers.

`sourceRoot = "source"` or `sourceRoot = "source/subdir"` is based on
the assumption that the `name` attribute of these pre-unpacked fetchers
are always `"source"`, which is not the case. Expecting constant `name`
also makes the source FODs prone to irrelevent hashes during version
bumps.

[1]: https://nixos.org/manual/nixpkgs/unstable/#var-stdenv-sourceRoot
[2]: https://nixos.org/manual/nixos/stable/release-notes#sec-release-23.11
2024-03-09 07:53:25 +08:00

73 lines
1.7 KiB
Nix

{ lib
, fetchFromGitLab
, python3Packages
, wrapGAppsHook4
, gst_all_1
, gobject-introspection
, yt-dlp
, libadwaita
, libsoup_3
, glib-networking
, nix-update-script
}:
python3Packages.buildPythonApplication rec {
pname = "monophony";
version = "2.7.0";
format = "other";
sourceRoot = "${src.name}/source";
src = fetchFromGitLab {
owner = "zehkira";
repo = "monophony";
rev = "v${version}";
hash = "sha256-uOmaTkjlfrct8CPqKcTTTqmURVncPZm4fXZYW+yZUf8=";
};
pythonPath = with python3Packages; [
mpris-server
pygobject3
ytmusicapi
];
nativeBuildInputs = [
python3Packages.nuitka
gobject-introspection
wrapGAppsHook4
];
buildInputs = [
libadwaita
# needed for gstreamer https
libsoup_3
glib-networking
] ++ (with gst_all_1; [
gst-plugins-base
gst-plugins-good
gstreamer
]);
installFlags = [ "prefix=$(out)" ];
preFixup = ''
buildPythonPath "$pythonPath"
gappsWrapperArgs+=(
--prefix PYTHONPATH : "$program_PYTHONPATH"
--prefix PATH : "${lib.makeBinPath [yt-dlp]}"
# needed for gstreamer https
--prefix LD_LIBRARY_PATH : "${lib.getLib libsoup_3}/lib"
)
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
homepage = "https://gitlab.com/zehkira/monophony";
description = "Linux app for streaming music from YouTube";
longDescription = "Monophony is a free and open source Linux app for streaming music from YouTube. It has no ads and does not require an account.";
license = licenses.agpl3Plus;
mainProgram = "monophony";
platforms = platforms.linux;
maintainers = with maintainers; [ quadradical ];
};
}