nixpkgs/pkgs/by-name/im/imgbrd-grabber/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

104 lines
2.5 KiB
Nix
Raw Normal View History

2024-05-17 13:59:42 +00:00
{
lib,
stdenv,
cmake,
fetchFromGitHub,
makeWrapper,
catch2,
nodejs,
libpulseaudio,
openssl,
rsync,
typescript,
qt6,
2020-10-19 03:06:49 +00:00
}:
2024-05-17 13:59:42 +00:00
stdenv.mkDerivation (finalAttrs: {
pname = "imgbrd-grabber";
2024-05-17 13:59:42 +00:00
version = "7.12.2";
2020-10-20 00:29:30 +00:00
src = fetchFromGitHub {
owner = "Bionus";
repo = "imgbrd-grabber";
2024-05-17 13:59:42 +00:00
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-6XfIaASfbvdPovtdDEJtsk4pEL4Dhmyq8ml4X7KZ4DE=";
2020-10-20 00:29:30 +00:00
fetchSubmodules = true;
};
2020-10-19 03:06:49 +00:00
2024-05-17 13:59:42 +00:00
buildInputs =
with qt6;
[
qtbase
qtdeclarative
qttools
qtnetworkauth
qtmultimedia
]
++ [
openssl
libpulseaudio
typescript
nodejs
];
2020-10-19 03:06:49 +00:00
nativeBuildInputs = [
makeWrapper
2024-05-17 13:59:42 +00:00
qt6.wrapQtAppsHook
2020-10-20 00:29:30 +00:00
cmake
2020-10-19 03:06:49 +00:00
];
2020-10-20 00:29:30 +00:00
extraOutputsToLink = [ "doc" ];
2024-05-17 13:59:42 +00:00
preBuild = ''
export HOME=$TMPDIR
2020-10-20 00:29:30 +00:00
# the package.sh script provides some install helpers
# using this might make it easier to maintain/less likely for the
# install phase to fail across version bumps
2024-05-17 13:59:42 +00:00
patchShebangs ../scripts/package.sh
'';
postPatch = ''
2020-10-20 00:29:30 +00:00
# ensure the script uses the rsync package from nixpkgs
2024-05-17 13:59:42 +00:00
substituteInPlace ../scripts/package.sh --replace-fail "rsync" "${lib.getExe rsync}"
2020-10-20 00:29:30 +00:00
2024-08-08 18:21:40 +00:00
substituteInPlace gui/CMakeLists.txt \
--replace-fail "find_package(Qt6 COMPONENTS " "find_package(Qt6 COMPONENTS NetworkAuth " \
--replace-fail "set(QT_LIBRARIES " "set(QT_LIBRARIES Qt6::NetworkAuth "
2020-10-19 03:06:49 +00:00
2020-10-20 00:29:30 +00:00
# the npm build step only runs typescript
# run this step directly so it doesn't try and fail to download the unnecessary node_modules, etc.
2024-05-17 13:59:42 +00:00
substituteInPlace ./sites/CMakeLists.txt --replace-fail "npm install" "npm run build"
2020-10-19 03:06:49 +00:00
2020-10-20 00:29:30 +00:00
# link the catch2 sources from nixpkgs
2024-05-17 13:59:42 +00:00
ln -sf ${catch2.src} tests/src/
2020-10-19 03:06:49 +00:00
'';
2020-10-20 00:29:30 +00:00
postInstall = ''
2020-10-20 00:52:25 +00:00
# move the binaries to the share/Grabber folder so
2020-10-20 00:29:30 +00:00
# some relative links can be resolved (e.g. settings.ini)
mv $out/bin/* $out/share/Grabber/
2020-10-20 00:52:25 +00:00
2020-10-20 00:29:30 +00:00
cd ../..
2020-10-20 02:42:34 +00:00
# run the package.sh with $out/share/Grabber as the $APP_DIR
2020-10-20 00:29:30 +00:00
sh ./scripts/package.sh $out/share/Grabber
2020-10-19 03:06:49 +00:00
2020-10-20 00:29:30 +00:00
# add symlinks for the binaries to $out/bin
ln -s $out/share/Grabber/Grabber $out/bin/Grabber
ln -s $out/share/Grabber/Grabber-cli $out/bin/Grabber-cli
'';
2024-05-17 13:59:42 +00:00
sourceRoot = "${finalAttrs.src.name}/src";
2024-05-17 13:59:42 +00:00
meta = {
description = "Very customizable imageboard/booru downloader with powerful filenaming features";
2024-05-17 13:59:42 +00:00
license = lib.licenses.asl20;
homepage = "https://bionus.github.io/imgbrd-grabber/";
mainProgram = "Grabber";
2024-05-17 13:59:42 +00:00
maintainers = with lib.maintainers; [
evanjs
luftmensch-luftmensch
];
};
2024-05-17 13:59:42 +00:00
})