From dd85e24ecd2175600a53d6d0d2508dbc3afe4fb4 Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Sun, 12 May 2024 22:09:17 -0700 Subject: [PATCH 1/2] sublime-music: unpin dependencies, fix build I did a few things here: - Removed the call to `xvfb-run`, it's no longer needed after upstream removed its ui tests: https://github.com/sublime-music/sublime-music/commit/bd573a0ed8faa246a35da6e16195826874e343fe - Unpin `dataclasses-json`. This fixes https://github.com/NixOS/nixpkgs/issues/311270. It was pinned in https://github.com/nixos/nixpkgs/commit/8780d5eecff5645b763e9e8c5457ac7b05d75b3d with no explanation. When unpinning, I discovered that sublime-music's tests fail when run with the latest version of `dataclasses-music`. There's already an issue filed upstream about this: https://github.com/sublime-music/sublime-music/issues/439 - To work around this, I switched to using `pytestCheckHook` and added `test_get_music_directory` to `disabledTests`. - Unpin `semver`. It was pinned in https://github.com/nixos/nixpkgs/commit/ac848b1e6896957ba84177844be0f0b41d06ae5f with no explanation. This isn't necessary to fix the build, but it felt like good hygiene while I was in here (we shouldn't be pinning things without an explanation *why* they're pinned). --- .../audio/sublime-music/default.nix | 45 ++++--------------- 1 file changed, 9 insertions(+), 36 deletions(-) diff --git a/pkgs/applications/audio/sublime-music/default.nix b/pkgs/applications/audio/sublime-music/default.nix index edb572ad1bd6..66039ad0597e 100644 --- a/pkgs/applications/audio/sublime-music/default.nix +++ b/pkgs/applications/audio/sublime-music/default.nix @@ -5,7 +5,6 @@ , gtk3 , pango , wrapGAppsHook3 -, xvfb-run , chromecastSupport ? false , serverSupport ? false , keyringSupport ? true @@ -15,34 +14,7 @@ , networkmanager }: -let - python = python3.override { - packageOverrides = self: super: { - semver = super.semver.overridePythonAttrs (oldAttrs: rec { - version = "2.13.0"; - src = fetchFromGitHub { - owner = "python-semver"; - repo = "python-semver"; - rev = "refs/tags/${version}"; - hash = "sha256-IWTo/P9JRxBQlhtcH3JMJZZrwAA8EALF4dtHajWUc4w="; - }; - doCheck = false; # no tests - }); - - dataclasses-json = super.dataclasses-json.overridePythonAttrs (oldAttrs: rec { - version = "0.5.7"; - src = fetchFromGitHub { - owner = "lidatong"; - repo = "dataclasses-json"; - rev = "refs/tags/v${version}"; - hash = "sha256-0tw5Lz+c4ymO+AGpG6THbiALWGBrehC84+yWWk1eafc="; - }; - nativeBuildInputs = [ python3.pkgs.setuptools ]; - }); - }; - }; -in -python.pkgs.buildPythonApplication rec { +python3.pkgs.buildPythonApplication rec { pname = "sublime-music"; version = "0.12.0"; format = "pyproject"; @@ -55,7 +27,7 @@ python.pkgs.buildPythonApplication rec { }; nativeBuildInputs = [ - python.pkgs.flit-core + python3.pkgs.flit-core gobject-introspection wrapGAppsHook3 ]; @@ -76,7 +48,7 @@ python.pkgs.buildPythonApplication rec { ++ lib.optional networkSupport networkmanager ; - propagatedBuildInputs = with python.pkgs; [ + propagatedBuildInputs = with python3.pkgs; [ bleach bottle dataclasses-json @@ -94,13 +66,14 @@ python.pkgs.buildPythonApplication rec { ++ lib.optional keyringSupport keyring ; - nativeCheckInputs = with python.pkgs; [ - pytest + nativeCheckInputs = with python3.pkgs; [ + pytestCheckHook ]; - checkPhase = '' - ${xvfb-run}/bin/xvfb-run pytest - ''; + disabledTests = [ + # https://github.com/sublime-music/sublime-music/issues/439 + "test_get_music_directory" + ]; pythonImportsCheck = [ "sublime_music" From a84a5b63902a4f4c45f598704f193494d5d8f0bd Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 16 May 2024 09:42:45 +0200 Subject: [PATCH 2/2] sublime-music: refactor --- .../audio/sublime-music/default.nix | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/pkgs/applications/audio/sublime-music/default.nix b/pkgs/applications/audio/sublime-music/default.nix index 66039ad0597e..a1c74abeca1c 100644 --- a/pkgs/applications/audio/sublime-music/default.nix +++ b/pkgs/applications/audio/sublime-music/default.nix @@ -17,21 +17,15 @@ python3.pkgs.buildPythonApplication rec { pname = "sublime-music"; version = "0.12.0"; - format = "pyproject"; + pyproject = true; src = fetchFromGitHub { owner = "sublime-music"; - repo = pname; + repo = "sublime-music"; rev = "refs/tags/v${version}"; hash = "sha256-FPzeFqDOcaiariz7qJwz6P3Wd+ZDxNP57uj+ptMtEyM="; }; - nativeBuildInputs = [ - python3.pkgs.flit-core - gobject-introspection - wrapGAppsHook3 - ]; - postPatch = '' sed -i "/--cov/d" setup.cfg sed -i "/--no-cov-on-fail/d" setup.cfg @@ -40,6 +34,15 @@ python3.pkgs.buildPythonApplication rec { sed -i "s/python-mpv/mpv/g" pyproject.toml ''; + build-system = with python3.pkgs; [ + flit-core + ]; + + nativeBuildInputs = [ + gobject-introspection + wrapGAppsHook3 + ]; + buildInputs = [ gtk3 pango @@ -91,10 +94,10 @@ python3.pkgs.buildPythonApplication rec { meta = with lib; { description = "GTK3 Subsonic/Airsonic client"; - mainProgram = "sublime-music"; homepage = "https://sublimemusic.app/"; changelog = "https://github.com/sublime-music/sublime-music/blob/v${version}/CHANGELOG.rst"; license = licenses.gpl3Plus; maintainers = with maintainers; [ albakham sumnerevans ]; + mainProgram = "sublime-music"; }; }