Skip to content

Instantly share code, notes, and snippets.

@ivan
Last active January 22, 2019 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan/48d8cb57e8eb763d13154fe51b984e86 to your computer and use it in GitHub Desktop.
Save ivan/48d8cb57e8eb763d13154fe51b984e86 to your computer and use it in GitHub Desktop.
NixOS: patch qBittorrent a bit
--- a/pkgs/applications/networking/p2p/qbittorrent/default.nix
+++ b/pkgs/applications/networking/p2p/qbittorrent/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkgconfig
+{ stdenv, fetchFromGitHub, pkgconfig, perl
, boost, libtorrentRasterbar, qtbase, qttools, qtsvg
, debugSupport ? false # Debugging
, guiSupport ? true, dbus ? null # GUI (disable to run headless)
@@ -22,12 +22,31 @@ stdenv.mkDerivation rec {
# NOTE: 2018-05-31: CMake is working but it is not officially supported
nativeBuildInputs = [ pkgconfig ];
- buildInputs = [ boost libtorrentRasterbar qtbase qttools qtsvg ]
+ buildInputs = [ perl boost libtorrentRasterbar qtbase qttools qtsvg ]
++ optional guiSupport dbus; # D(esktop)-Bus depends on GUI support
# Otherwise qm_gen.pri assumes lrelease-qt5, which does not exist.
QMAKE_LRELEASE = "lrelease";
+ postPatch = ''
+ # Download torrents sequentially by default so that we can stream video
+ substituteInPlace src/base/bittorrent/addtorrentparams.h \
+ --replace 'bool sequential = false;' 'bool sequential = true;'
+ substituteInPlace src/base/bittorrent/torrenthandle.cpp \
+ --replace 'sequential(false)' 'sequential(true)'
+
+ # webui: remove "pause all" and "resume all" menu items that are too close
+ # to the add torrent buttons
+ sed -i -r 's,<li><a id="resumeAllLink">.+?</li>,,g' src/webui/www/private/index.html
+ sed -i -r 's,<li><a id="pauseAllLink">.+?</li>,,g' src/webui/www/private/index.html
+
+ # webui: make text black instead of gray
+ sed -i -r 's/color: #555;/color: #000;/g' src/webui/www/private/css/style.css
+
+ # webui: don't alternate row background color
+ perl -0777 -i -pe 's/\.dynamicTable tbody tr\.alt \{\n.*?\n}/.dynamicTable tbody tr.alt {}/gs' src/webui/www/private/css/dynamicTable.css
+ '';
+
configureFlags = [
"--with-boost-libdir=${boost.out}/lib"
"--with-boost=${boost.dev}" ]
--
2.19.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment