NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.73k stars 13.16k forks source link

Package request: freedownloadmanager #225020

Open bayazidbh opened 1 year ago

bayazidbh commented 1 year ago

Project description

"FDM is a powerful modern download accelerator and organizer."

"Free Download Manager for Windows, macOS, Android, and Linux allows you to adjust traffic usage, organize downloads, control file priorities for torrents, efficiently download large files and resume broken downloads."

Metadata

Only available as .deb on Linux, AUR version also uses that .deb.

I primarily use it as a two-in-one browser download manager (useful for bigger files, to make it easier to resume in case of issues) as well as torrent manager. I find it convenient to have a single app for both, and I'd be happy to have an easy access for this on NixOS and non-deb distro, thank you.

ghost commented 1 year ago

Having this would be great. I use it on my other linux and windows machines.

zendo commented 1 year ago

I've done this before.

{ lib
, stdenv
, fetchurl
, dpkg
, wrapGAppsHook
, autoPatchelfHook
, udev
, libdrm
, libpqxx
, unixODBC
, gst_all_1
}:

stdenv.mkDerivation rec {
  pname = "freedownloadmanager";
  version = "6.19.0";

  src = fetchurl {
    url = "https://files2.freedownloadmanager.org/6/latest/freedownloadmanager.deb";
    hash = "sha256-qTc2PIIfW+YuSAb8z3Vpf2bTdhumoZXOATsBUG2EYTY=";
  };

  unpackPhase = "dpkg-deb -x $src .";

  nativeBuildInputs = [
    dpkg
    wrapGAppsHook
    autoPatchelfHook
  ];

  buildInputs = [
    libdrm
    libpqxx
    unixODBC
    stdenv.cc.cc
  ] ++ (with gst_all_1; [
    gstreamer
    gst-libav
    gst-plugins-base
    gst-plugins-good
    gst-plugins-bad
    gst-plugins-ugly
  ]);

  runtimeDependencies = [
    (lib.getLib udev)
  ];

  installPhase = ''
    mkdir -p $out/bin
    cp -r opt/freedownloadmanager $out
    cp -r usr/share $out
    ln -s $out/freedownloadmanager/fdm $out/bin/${pname}

    substituteInPlace $out/share/applications/freedownloadmanager.desktop \
      --replace 'Exec=/opt/freedownloadmanager/fdm' 'Exec=${pname}' \
      --replace "Icon=/opt/freedownloadmanager/icon.png" "Icon=$out/freedownloadmanager/icon.png"
  '';

  meta = with lib; {
    description = "A smart and fast internet download manager";
    homepage = "https://www.freedownloadmanager.org";
    license = licenses.unfree;
    platforms = [ "x86_64-linux" ];
    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
    maintainers = with maintainers; [  ];
  };
}
bayazidbh commented 1 year ago

That's neat. I'm still new to Nix, so I'm not sure about the policy but I think exec should also have QT_QPA_PLATFORM=xcb just in case user is on wayland since I recently tested it on Nobara and the window won't show up unless you specify that env var.

LDprg commented 10 months ago

Will FDM make it to the nixOS pkgs? I would really like it to be a default pkgs!