nixpkgs/pkgs/tools/misc/hakuneko/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

86 lines
2.0 KiB
Nix

{ atomEnv
, autoPatchelfHook
, dpkg
, fetchurl
, makeDesktopItem
, makeWrapper
, udev
, stdenv
, lib
, 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 = "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}";
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
'';
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/";
license = licenses.unlicense;
maintainers = with maintainers; [
nloomans
];
platforms = [
"x86_64-linux"
"i686-linux"
];
};
}