nixpkgs/pkgs/by-name/ha/hakuneko/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

99 lines
2.3 KiB
Nix

{ autoPatchelfHook
, dpkg
, fetchurl
, makeDesktopItem
, makeWrapper
, udev
, stdenv
, lib
, wrapGAppsHook3
, alsa-lib
, nss
, nspr
, systemd
, xorg
}:
let
desktopItem = makeDesktopItem {
desktopName = "HakuNeko Desktop";
genericName = "Manga & Anime Downloader";
categories = [ "Network" "FileTransfer" ];
exec = "hakuneko";
icon = "hakuneko-desktop";
name = "hakuneko-desktop";
};
in
stdenv.mkDerivation rec {
pname = "hakuneko";
version = "6.1.7";
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}" or (throw "unsupported system ${stdenv.hostPlatform.system}");
dontBuild = true;
dontConfigure = true;
dontPatchELF = true;
dontWrapGApps = true;
# TODO: migrate off autoPatchelfHook and use nixpkgs' electron
nativeBuildInputs = [
autoPatchelfHook
dpkg
makeWrapper
wrapGAppsHook3
];
buildInputs = [
alsa-lib
nss
nspr
xorg.libXScrnSaver
xorg.libXtst
systemd
];
unpackPhase = ''
# The deb file contains a setuid binary, so 'dpkg -x' doesn't work here
dpkg --fsys-tarfile $src | tar --extract
'';
installPhase = ''
cp -R usr "$out"
# Overwrite existing .desktop file.
cp "${desktopItem}/share/applications/hakuneko-desktop.desktop" \
"$out/share/applications/hakuneko-desktop.desktop"
'';
runtimeDependencies = [
(lib.getLib udev)
];
postFixup = ''
makeWrapper $out/lib/hakuneko-desktop/hakuneko $out/bin/hakuneko \
"''${gappsWrapperArgs[@]}"
'';
meta = with lib; {
description = "Manga & Anime Downloader";
homepage = "https://sourceforge.net/projects/hakuneko/";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unlicense;
maintainers = with maintainers; [
nloomans
];
platforms = [
"x86_64-linux"
"i686-linux"
];
mainProgram = "hakuneko";
};
}