From 8ad56944fa000006a057e191f70ff7752c6d540b Mon Sep 17 00:00:00 2001 From: Evan Stoll Date: Sun, 18 Oct 2020 23:06:49 -0400 Subject: [PATCH 1/4] imgbrd-grabber: init at 7.3.2 --- .../graphics/imgbrd-grabber/default.nix | 50 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 52 insertions(+) create mode 100644 pkgs/applications/graphics/imgbrd-grabber/default.nix diff --git a/pkgs/applications/graphics/imgbrd-grabber/default.nix b/pkgs/applications/graphics/imgbrd-grabber/default.nix new file mode 100644 index 000000000000..994f2a10e6cd --- /dev/null +++ b/pkgs/applications/graphics/imgbrd-grabber/default.nix @@ -0,0 +1,50 @@ +{ stdenv +, cmake +, fetchzip +, openssl +, autoPatchelfHook +, makeWrapper +, qtmultimedia +, wrapQtAppsHook +}: +stdenv.mkDerivation rec { + name = "imgbrd-grabber"; + version = "7.3.2"; + + buildInputs = [ + stdenv.cc.cc.lib + openssl + qtmultimedia + ]; + + nativeBuildInputs = [ + autoPatchelfHook + makeWrapper + wrapQtAppsHook + ]; + + installPhase = '' + mkdir -p $out/share/grabber + cp -R * $out/share/grabber + + mkdir -p $out/bin + ln -s $out/share/grabber/Grabber /$out/bin/grabber + + mkdir -p $out/share/applications + mv $out/share/grabber/Grabber.desktop $out/share/applications/ + + ''; + + src = fetchzip { + url = "https://github.com/Bionus/imgbrd-grabber/releases/download/v${version}/Grabber_v${version}.tar.gz"; + sha256 = "05isnqhvcp8ycaj8hx6wn0c3la729mb36dzpmlpxfb1p5dj8p49k"; + }; + + meta = with stdenv.lib; { + homepage = "https://github.com/Bionus/imgbrd-grabber"; + description = "Very customizable imageboard/booru downloader with powerful filenaming features."; + license = licenses.asl20; + platforms = [ "x86_64-linux" ]; + maintainers = with maintainers; [ evanjs ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 850c4243b0d4..166cf8e079dd 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21429,6 +21429,8 @@ in img2pdf = with python3Packages; toPythonApplication img2pdf; + imgbrd-grabber = qt5.callPackage ../applications/graphics/imgbrd-grabber { }; + imgcat = callPackage ../applications/graphics/imgcat { }; imgp = python3Packages.callPackage ../applications/graphics/imgp { }; From 99e2f6cb8eb52bc37771f1354e74e419efc7827d Mon Sep 17 00:00:00 2001 From: Evan Stoll Date: Mon, 19 Oct 2020 20:29:30 -0400 Subject: [PATCH 2/4] imgbrd-grabber: build from source --- .../graphics/imgbrd-grabber/default.nix | 91 +++++++++++++------ pkgs/top-level/all-packages.nix | 4 +- 2 files changed, 67 insertions(+), 28 deletions(-) diff --git a/pkgs/applications/graphics/imgbrd-grabber/default.nix b/pkgs/applications/graphics/imgbrd-grabber/default.nix index 994f2a10e6cd..259f40567072 100644 --- a/pkgs/applications/graphics/imgbrd-grabber/default.nix +++ b/pkgs/applications/graphics/imgbrd-grabber/default.nix @@ -1,50 +1,87 @@ { stdenv , cmake -, fetchzip -, openssl -, autoPatchelfHook -, makeWrapper -, qtmultimedia +, fetchFromGitHub , wrapQtAppsHook +, qtmultimedia +, qttools +, qtscript +, qtdeclarative +, qtbase +, autogen +, automake +, makeWrapper +, catch2 +, nodejs +, libpulseaudio +, openssl +, rsync +, typescript }: stdenv.mkDerivation rec { name = "imgbrd-grabber"; + version = "7.3.2"; + src = fetchFromGitHub { + owner = "Bionus"; + repo = "imgbrd-grabber"; + rev = "v${version}"; + sha256 = "053rwvcr88fcba0447a6r115cgnqsm9rl066z8d5jacqnhdij58k"; + fetchSubmodules = true; + }; buildInputs = [ - stdenv.cc.cc.lib openssl - qtmultimedia + makeWrapper + libpulseaudio + typescript ]; nativeBuildInputs = [ - autoPatchelfHook - makeWrapper + qtmultimedia + qtbase + qtdeclarative + qttools + nodejs + cmake wrapQtAppsHook ]; - installPhase = '' - mkdir -p $out/share/grabber - cp -R * $out/share/grabber + extraOutputsToLink = [ "doc" ]; - mkdir -p $out/bin - ln -s $out/share/grabber/Grabber /$out/bin/grabber + 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 - mkdir -p $out/share/applications - mv $out/share/grabber/Grabber.desktop $out/share/applications/ + # ensure the script uses the rsync package from nixpkgs + substituteInPlace ../scripts/package.sh --replace "rsync" "${rsync}/bin/rsync" + + # 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" + + # remove the vendored catch2 + rm -rf tests/src/vendor/catch + + # link the catch2 sources from nixpkgs + ln -sf ${catch2.src} tests/src/vendor/catch ''; - src = fetchzip { - url = "https://github.com/Bionus/imgbrd-grabber/releases/download/v${version}/Grabber_v${version}.tar.gz"; - sha256 = "05isnqhvcp8ycaj8hx6wn0c3la729mb36dzpmlpxfb1p5dj8p49k"; - }; + postInstall = '' + # move the binaries to the share/Grabber folder so + # some relative links can be resolved (e.g. settings.ini) + mv $out/bin/* $out/share/Grabber/ + + cd ../.. + # run the package.sh with $out/share/Grabber as the $APP_DIR + sh ./scripts/package.sh $out/share/Grabber - meta = with stdenv.lib; { - homepage = "https://github.com/Bionus/imgbrd-grabber"; - description = "Very customizable imageboard/booru downloader with powerful filenaming features."; - license = licenses.asl20; - platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ evanjs ]; - }; + # 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"; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 166cf8e079dd..fbac860828b8 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21429,7 +21429,9 @@ in img2pdf = with python3Packages; toPythonApplication img2pdf; - imgbrd-grabber = qt5.callPackage ../applications/graphics/imgbrd-grabber { }; + imgbrd-grabber = qt5.callPackage ../applications/graphics/imgbrd-grabber/default.nix { + typescript = nodePackages.typescript; + }; imgcat = callPackage ../applications/graphics/imgcat { }; From 80d34ab9a4822c2ede2642274ce2af5cc25d2897 Mon Sep 17 00:00:00 2001 From: Evan Stoll Date: Mon, 19 Oct 2020 20:52:25 -0400 Subject: [PATCH 3/4] Remove trailing whitespace --- pkgs/applications/graphics/imgbrd-grabber/default.nix | 4 ++-- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/graphics/imgbrd-grabber/default.nix b/pkgs/applications/graphics/imgbrd-grabber/default.nix index 259f40567072..883279511162 100644 --- a/pkgs/applications/graphics/imgbrd-grabber/default.nix +++ b/pkgs/applications/graphics/imgbrd-grabber/default.nix @@ -70,10 +70,10 @@ stdenv.mkDerivation rec { ''; postInstall = '' - # move the binaries to the share/Grabber folder so + # move the binaries to the share/Grabber folder so # some relative links can be resolved (e.g. settings.ini) mv $out/bin/* $out/share/Grabber/ - + cd ../.. # run the package.sh with $out/share/Grabber as the $APP_DIR sh ./scripts/package.sh $out/share/Grabber diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fbac860828b8..54fd9d260d87 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21429,7 +21429,7 @@ in img2pdf = with python3Packages; toPythonApplication img2pdf; - imgbrd-grabber = qt5.callPackage ../applications/graphics/imgbrd-grabber/default.nix { + imgbrd-grabber = qt5.callPackage ../applications/graphics/imgbrd-grabber/default.nix { typescript = nodePackages.typescript; }; From 04bac4958cd5034df19709e4bdd1954326b1f583 Mon Sep 17 00:00:00 2001 From: Evan Stoll Date: Mon, 19 Oct 2020 22:42:34 -0400 Subject: [PATCH 4/4] Remove trailing whitespace --- pkgs/applications/graphics/imgbrd-grabber/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/graphics/imgbrd-grabber/default.nix b/pkgs/applications/graphics/imgbrd-grabber/default.nix index 883279511162..f07db4c5c4a6 100644 --- a/pkgs/applications/graphics/imgbrd-grabber/default.nix +++ b/pkgs/applications/graphics/imgbrd-grabber/default.nix @@ -75,7 +75,7 @@ stdenv.mkDerivation rec { mv $out/bin/* $out/share/Grabber/ cd ../.. - # run the package.sh with $out/share/Grabber as the $APP_DIR + # run the package.sh with $out/share/Grabber as the $APP_DIR sh ./scripts/package.sh $out/share/Grabber # add symlinks for the binaries to $out/bin