Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qbittorrent-enhanced: 4.6.7.10 -> 5.0.2.10; add nox variant #358112

Merged
merged 2 commits into from
Dec 23, 2024

Conversation

KSJ2000
Copy link
Contributor

@KSJ2000 KSJ2000 commented Nov 22, 2024

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@KSJ2000
Copy link
Contributor Author

KSJ2000 commented Nov 22, 2024

@KSJ2000 KSJ2000 force-pushed the qBittorrent-Enhanced-Edition branch 2 times, most recently from 7ab5ba0 to 0bf40bc Compare November 24, 2024 11:38
@@ -15462,6 +15462,8 @@ with pkgs;
};
qbittorrent-nox = qbittorrent.override { guiSupport = false; };

qbittorrent-enhanced-nox = callPackage ../by-name/qb/qbittorrent-enhanced/package.nix { guiSupport = false; };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
qbittorrent-enhanced-nox = callPackage ../by-name/qb/qbittorrent-enhanced/package.nix { guiSupport = false; };
qbittorrent-enhanced-nox = qbittorrent-enhanced.override { guiSupport = false; };

Copy link
Contributor Author

@KSJ2000 KSJ2000 Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does .override work on package.nix? since this package is different from the above (qbittorrent-nox) which is a default.nix
#358115 (comment)

Also, can the name of the binary be overridden as well? since even tho the application is qbittorrent-enhanced, the binary is just qbittorrent, making it fail on macos.
Should I change the name from postInstall and mainProgram to just qbittorrent?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.override should also work.

But I wonder what's the different between .override and callPackage .. { }, is it related to package splicing?

I've seen quite a lot of callPackage ../by-name usages:

$ grep -F 'callPackage ../by-name' pkgs/top-level/all-packages.nix | wc -l
147

But .override with packages from by-name can not be easily counted.

@ofborg ofborg bot requested a review from ByteSudoer November 25, 2024 02:33
@wegank wegank added 12.approvals: 1 This PR was reviewed and approved by one reputable person 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package labels Nov 25, 2024
Copy link
Contributor

@azuwis azuwis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of duplicating all the code with qbittorrent, I think we can also rewrite to something like:

{
  lib,
  fetchFromGitHub,
  qbittorrent,
  guiSupport ? true,
}:

(qbittorrent.override { inherit guiSupport; }).overrideAttrs (old: rec {
  pname = "qbittorrent-enhanced" + lib.optionalString (!guiSupport) "-nox";
  version = "5.0.2.10";

  src = fetchFromGitHub {
    owner = "c0re100";
    repo = "qBittorrent-Enhanced-Edition";
    rev = "release-${version}";
    hash = "sha256-9RCG530zWQ+qzP0Y+y69NFlBWVA8GT29dY8aC1cvq7o=";
  };

  meta = old.meta // {
    description = "Unofficial enhanced version of qBittorrent, a BitTorrent client";
    homepage = "https://github.com/c0re100/qBittorrent-Enhanced-Edition";
    changelog = "https://github.com/c0re100/qBittorrent-Enhanced-Edition/blob/release-${version}/Changelog";
    maintainers = with lib.maintainers; [ ByteSudoer ];
  };
})

Or even better, integrate into qbittorrent like the -nox variant.

@KSJ2000
Copy link
Contributor Author

KSJ2000 commented Nov 29, 2024

@azuwis It seems to build and work.

{
enhancedSupport ? false,
}:

stdenv.mkDerivation (finalAttrs: {
  pname =
    "qbittorrent"
    + lib.optionalString (enhancedSupport) "-enhanced"
    + lib.optionalString (!guiSupport) "-nox";
  version = "5.0.2" + lib.optionalString (enhancedSupport) ".10";

  src =
    if enhancedSupport then
      fetchFromGitHub {
        owner = "c0re100";
        repo = "qBittorrent-Enhanced-Edition";
        rev = "release-${finalAttrs.version}";
        hash = "sha256-9RCG530zWQ+qzP0Y+y69NFlBWVA8GT29dY8aC1cvq7o=";
      }
    else
      fetchFromGitHub {
        owner = "qbittorrent";
        repo = "qBittorrent";
        rev = "release-${finalAttrs.version}";
        hash = "sha256-JIURzAkVNYjHAx8yY0WaKNK4N/z9ndqjk0EXkJH9AzY=";
      };

Then I'm guessing in all-packages.nix, it would be:

qbittorrent-nox = qbittorrent.override { guiSupport = false; };
qbittorrent-enhanced = qbittorrent.override { enhancedSupport = true; };
qbittorrent-enhanced-nox = qbittorrent-enhanced.override { guiSupport = false; };
//OR
qbittorrent-enhanced-nox = qbittorrent.override {  enhancedSupport = true; guiSupport = false; };
//Don't know which, probably the latter?

@ByteSudoer Would you mind if I did the above, deleted the /qbittorrent-enhanced/package.nix and add you to the qbittorrent maintainer list instead?

@azuwis
Copy link
Contributor

azuwis commented Nov 29, 2024

On second thought, I think the solution here #358112 (review) is good enough.

Integrating into qbittorrent may cause to much complexity, and not worth it.

@KSJ2000
Copy link
Contributor Author

KSJ2000 commented Nov 29, 2024

What about this?

stdenv.mkDerivation (finalAttrs: {
  pname =
    "qbittorrent"
    + lib.optionalString enhancedSupport "-enhanced"
    + lib.optionalString (!guiSupport) "-nox";
  version = if enhancedSupport then "5.0.2.10" else "5.0.2";
  owner = if enhancedSupport then "c0re100" else "qbittorrent";
  repo = if enhancedSupport then "qBittorrent-Enhanced-Edition" else "qBittorrent";
  hash =
    if enhancedSupport then
      "sha256-9RCG530zWQ+qzP0Y+y69NFlBWVA8GT29dY8aC1cvq7o="
    else
      "sha256-JIURzAkVNYjHAx8yY0WaKNK4N/z9ndqjk0EXkJH9AzY=";

  src = fetchFromGitHub {
    inherit (finalAttrs) owner repo hash;
    rev = "release-${finalAttrs.version}";
  };
  

  meta = {
    description =
      "Featureful free software BitTorrent client"
      + lib.optionalString enhancedSupport " (Enhanced Edition with additional features)";
    homepage = "https://github.com/${finalAttrs.owner}/${finalAttrs.repo}";
    changelog = "https://github.com/${finalAttrs.owner}/${finalAttrs.repo}/blob/release-${finalAttrs.version}/Changelog";

Does this still feel too complicated?

@azuwis
Copy link
Contributor

azuwis commented Nov 29, 2024

I think #358112 (review) is concise and easy to read.

@KSJ2000 KSJ2000 force-pushed the qBittorrent-Enhanced-Edition branch from 0bf40bc to 612f825 Compare November 29, 2024 09:50
@KSJ2000 KSJ2000 changed the title qbittorrent-enhanced: 4.6.7.10 -> 5.0.2.10 qbittorrent-enhanced: 4.6.7.10 -> 5.0.2.10; add nox variant Nov 29, 2024
@wegank wegank removed 12.approvals: 1 This PR was reviewed and approved by one reputable person 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package labels Dec 1, 2024
@KSJ2000 KSJ2000 requested a review from Aleksanaa December 2, 2024 08:59
@azuwis
Copy link
Contributor

azuwis commented Dec 12, 2024

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 358112


x86_64-linux

✅ 2 packages built:
  • qbittorrent-enhanced
  • qbittorrent-enhanced-nox

aarch64-darwin

✅ 2 packages built:
  • qbittorrent-enhanced
  • qbittorrent-enhanced-nox

x86_64-darwin

✅ 2 packages built:
  • qbittorrent-enhanced
  • qbittorrent-enhanced-nox

@wegank wegank added 12.approvals: 2 This PR was reviewed and approved by two reputable people 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package labels Dec 20, 2024
@FliegendeWurst FliegendeWurst merged commit 2c981cb into NixOS:master Dec 23, 2024
41 checks passed
@KSJ2000 KSJ2000 deleted the qBittorrent-Enhanced-Edition branch January 4, 2025 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-linux: 1-10 12.approvals: 2 This PR was reviewed and approved by two reputable people 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants