Skip to content

Commit

Permalink
jdownloader2: init at 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
remgodow committed Sep 13, 2021
1 parent d5540fa commit 7d075d3
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
68 changes: 68 additions & 0 deletions pkgs/applications/networking/jdownloader2/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{ stdenv, lib, fetchurl, writeScript, makeDesktopItem, copyDesktopItems, jre, imagemagick, coreutils }:

let

icon = fetchurl {
url = "https://jdownloader.org/_media/vote/trazo.png";
sha256 = "3ebab992e7dd04ffcb6c30fee1a7e2b43f3537cb2b22124b30325d25bffdac29";
};

wrapper = writeScript "jdownloader" ''
#! ${stdenv.shell}
PATH=${lib.makeBinPath [ jre coreutils ]}
JDJAR=''${XDG_DATA_HOME:-$HOME/.local/share}/jdownloader/JDownloader.jar
dir=`dirname "$0"`
if [ ! -f ''${JDJAR} ]; then
install -Dm755 $dir/JDownloader.jar ''${JDJAR}
fi
${jre}/bin/java -jar ''${JDJAR} "''${@}"
'';

in stdenv.mkDerivation rec {
pname = "jdownloader2";
version = "2.0";

#there is no https endpoint for this domain
src = fetchurl {
url = "https://archive.org/download/jdownloader_202109/JDownloader.jar";
sha256 = "9951b786e24fc3777a0df0a7b516ba53d0c8e778d6a69ebc29dcff86ee6b5829";
};

dontUnpack = true;

nativeBuildInputs = [ imagemagick copyDesktopItems ];

desktopItems = [
(makeDesktopItem {
name = "JDownloader 2";
exec = wrapper;
icon = "jdownloader";
comment = "Free, open-source download management tool.";
desktopName = "JDownloader 2";
genericName = "JDownloader 2";
categories = "Network;";
})
];

installPhase = ''
mkdir -pv $out/bin $out/share/applications
cp ${src} $out/bin/JDownloader.jar
# create icons
for size in 16 32 48 64 72 96 128 192 512 1024; do
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
convert -resize "$size"x"$size" \
${icon} \
$out/share/icons/hicolor/"$size"x"$size"/apps/jdownloader.png
done
'';

# Some easy metadata, in case I forget.
meta = with lib; {
homepage = "https://jdownloader.org/";
description = "Free, open-source download management tool";
license = licenses.gpl3Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ remgodow ];
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25652,6 +25652,8 @@ with pkgs;

dupd = callPackage ../tools/misc/dupd { };

jdownloader2 = callPackage ../applications/networking/jdownloader2 { };

jdupes = callPackage ../tools/misc/jdupes { };

jed = callPackage ../applications/editors/jed { };
Expand Down

0 comments on commit 7d075d3

Please sign in to comment.