nixpkgs/pkgs/applications/graphics/imgbrd-grabber/default.nix

88 lines
2.0 KiB
Nix
Raw Normal View History

2020-10-19 04:06:49 +01:00
{ stdenv
, cmake
2020-10-20 01:29:30 +01:00
, fetchFromGitHub
2020-10-19 04:06:49 +01:00
, wrapQtAppsHook
2020-10-20 01:29:30 +01:00
, qtmultimedia
, qttools
, qtscript
, qtdeclarative
, qtbase
, autogen
, automake
, makeWrapper
, catch2
, nodejs
, libpulseaudio
, openssl
, rsync
, typescript
2020-10-19 04:06:49 +01:00
}:
stdenv.mkDerivation rec {
name = "imgbrd-grabber";
2020-10-20 01:29:30 +01:00
2020-10-19 04:06:49 +01:00
version = "7.3.2";
2020-10-20 01:29:30 +01:00
src = fetchFromGitHub {
owner = "Bionus";
repo = "imgbrd-grabber";
rev = "v${version}";
sha256 = "053rwvcr88fcba0447a6r115cgnqsm9rl066z8d5jacqnhdij58k";
fetchSubmodules = true;
};
2020-10-19 04:06:49 +01:00
buildInputs = [
openssl
2020-10-20 01:29:30 +01:00
makeWrapper
libpulseaudio
typescript
2020-10-19 04:06:49 +01:00
];
nativeBuildInputs = [
2020-10-20 01:29:30 +01:00
qtmultimedia
qtbase
qtdeclarative
qttools
nodejs
cmake
2020-10-19 04:06:49 +01:00
wrapQtAppsHook
];
2020-10-20 01:29:30 +01:00
extraOutputsToLink = [ "doc" ];
postPatch = ''
# 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
patchShebangs ./scripts/package.sh
# ensure the script uses the rsync package from nixpkgs
substituteInPlace ../scripts/package.sh --replace "rsync" "${rsync}/bin/rsync"
2020-10-19 04:06:49 +01:00
2020-10-20 01:29:30 +01: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.
substituteInPlace ./sites/CMakeLists.txt --replace "npm install" "npm run build"
2020-10-19 04:06:49 +01:00
2020-10-20 01:29:30 +01:00
# remove the vendored catch2
rm -rf tests/src/vendor/catch
2020-10-19 04:06:49 +01:00
2020-10-20 01:29:30 +01:00
# link the catch2 sources from nixpkgs
ln -sf ${catch2.src} tests/src/vendor/catch
2020-10-19 04:06:49 +01:00
'';
2020-10-20 01:29:30 +01:00
postInstall = ''
2020-10-20 01:52:25 +01:00
# move the binaries to the share/Grabber folder so
2020-10-20 01:29:30 +01:00
# some relative links can be resolved (e.g. settings.ini)
mv $out/bin/* $out/share/Grabber/
2020-10-20 01:52:25 +01:00
2020-10-20 01:29:30 +01:00
cd ../..
2020-10-20 03:42:34 +01:00
# run the package.sh with $out/share/Grabber as the $APP_DIR
2020-10-20 01:29:30 +01:00
sh ./scripts/package.sh $out/share/Grabber
2020-10-19 04:06:49 +01:00
2020-10-20 01:29:30 +01: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
'';
sourceRoot = "source/src";
2020-10-19 04:06:49 +01:00
}