summary refs log tree commit diff
path: root/pkgs/tools/misc/hakuneko/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/misc/hakuneko/default.nix')
-rw-r--r--pkgs/tools/misc/hakuneko/default.nix94
1 files changed, 75 insertions, 19 deletions
diff --git a/pkgs/tools/misc/hakuneko/default.nix b/pkgs/tools/misc/hakuneko/default.nix
index 8c2e7dc7451..34405ccc7be 100644
--- a/pkgs/tools/misc/hakuneko/default.nix
+++ b/pkgs/tools/misc/hakuneko/default.nix
@@ -1,28 +1,84 @@
-{ stdenv, fetchurl, wxGTK30, openssl, curl }:
-
+{ atomEnv
+, autoPatchelfHook
+, dpkg
+, fetchurl
+, makeDesktopItem
+, makeWrapper
+, udev
+, stdenv
+, wrapGAppsHook
+}:
+let
+  desktopItem = makeDesktopItem {
+    desktopName = "HakuNeko Desktop";
+    genericName = "Manga & Anime Downloader";
+    categories = "Network;FileTransfer;";
+    exec = "hakuneko";
+    icon = "hakuneko-desktop";
+    name = "hakuneko-desktop";
+    type = "Application";
+  };
+in
 stdenv.mkDerivation rec {
   pname = "hakuneko";
-  version = "1.4.2";
+  version = "6.1.7";
 
-  src = fetchurl {
-    url = "mirror://sourceforge/hakuneko/hakuneko_${version}_src.tar.gz";
-    sha256 = "76a63fa05e91b082cb5a70a8abacef005354e99978ff8b1369f7aa0af7615d52";
-  };
+  src = {
+    "x86_64-linux" = fetchurl {
+      url = "https://github.com/manga-download/hakuneko/releases/download/v${version}/hakuneko-desktop_${version}_linux_amd64.deb";
+      sha256 = "06bb17d7a06bb0601053eaaf423f9176f06ff3636cc43ffc024438e1962dcd02";
+    };
+    "i686-linux" = fetchurl {
+      url = "https://github.com/manga-download/hakuneko/releases/download/v${version}/hakuneko-desktop_${version}_linux_i386.deb";
+      sha256 = "32017d26bafffaaf0a83dd6954d3926557014af4022a972371169c56c0e3d98b";
+    };
+  }."${stdenv.hostPlatform.system}";
+
+  dontBuild = true;
+  dontConfigure = true;
+  dontPatchELF = true;
+  dontWrapGApps = true;
+
+  nativeBuildInputs = [
+    autoPatchelfHook
+    dpkg
+    makeWrapper
+    wrapGAppsHook
+  ];
+
+  buildInputs = atomEnv.packages;
+
+  unpackPhase = ''
+    # The deb file contains a setuid binary, so 'dpkg -x' doesn't work here
+    dpkg --fsys-tarfile $src | tar --extract
+  '';
 
-  preConfigure = ''
-    substituteInPlace ./configure \
-       --replace /bin/bash $shell
-    '';
+  installPhase = ''
+    cp -R usr "$out"
+    # Overwrite existing .desktop file.
+    cp "${desktopItem}/share/applications/hakuneko-desktop.desktop" \
+       "$out/share/applications/hakuneko-desktop.desktop"
+  '';
 
-  buildInputs = [ wxGTK30 openssl curl ];
+  runtimeDependencies = [
+    udev.lib
+  ];
 
-  meta = {
-    description = "Manga downloader";
-    homepage = https://sourceforge.net/projects/hakuneko/;
-    license = stdenv.lib.licenses.mit;
-    platforms = stdenv.lib.platforms.linux;
+  postFixup = ''
+    makeWrapper $out/lib/hakuneko-desktop/hakuneko $out/bin/hakuneko \
+      "''${gappsWrapperArgs[@]}"
+  '';
 
-    # This project was abandoned upstream.
-    broken = true;
+  meta = with stdenv.lib; {
+    description = "Manga & Anime Downloader";
+    homepage = "https://sourceforge.net/projects/hakuneko/";
+    license = licenses.unlicense;
+    maintainers = with maintainers; [
+      nloomans
+    ];
+    platforms = [
+      "x86_64-linux"
+      "i686-linux"
+    ];
   };
 }