From a68a408a7ff80ef8e573d6b922ee824f68122292 Mon Sep 17 00:00:00 2001 From: Symphorien Gibol Date: Fri, 1 May 2020 12:00:00 +0000 Subject: [PATCH] multibootusb: patchelf syslinux, add missing dependencies --- .../misc/multibootusb/default.nix | 43 ++++++++++++++++--- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/misc/multibootusb/default.nix b/pkgs/applications/misc/multibootusb/default.nix index 5225f88094fd..8f90c7a581d0 100644 --- a/pkgs/applications/misc/multibootusb/default.nix +++ b/pkgs/applications/misc/multibootusb/default.nix @@ -1,4 +1,5 @@ -{ fetchFromGitHub, libxcb, mtools, p7zip, parted, procps, +{ fetchFromGitHub, libxcb, mtools, p7zip, parted, procps, qemu, unzip, zip, + coreutils, gnugrep, which, gnused, e2fsprogs, autoPatchelfHook, gptfdisk, python36Packages, qt5, runtimeShell, stdenv, utillinux, wrapQtAppsHook }: # Note: Multibootusb is tricky to maintain. It relies on the @@ -19,17 +20,30 @@ python36Packages.buildPythonApplication rec { nativeBuildInputs = [ wrapQtAppsHook + autoPatchelfHook + unzip + zip + ]; + + runTimeDeps = [ + coreutils + gnugrep + which + parted + utillinux + qemu + p7zip + gnused + mtools + procps + e2fsprogs + gptfdisk ]; buildInputs = [ libxcb - mtools - p7zip - parted - procps python36Packages.python qt5.full - utillinux ]; src = fetchFromGitHub { @@ -52,6 +66,20 @@ python36Packages.buildPythonApplication rec { python36Packages.six ]; + # multibootusb ships zips with various versions of syslinux, we need to patchelf them + postPatch = '' + for zip in $(find . -name "*.zip"); do + zip=$(readlink -f $zip) + target="$(mktemp -d)" + pushd $target + unzip $zip + rm $zip + autoPatchelf . + zip -r $zip * + popd + done + ''; + postInstall = '' # This script doesn't work and it doesn't add much anyway rm $out/bin/multibootusb-pkexec @@ -69,6 +97,9 @@ python36Packages.buildPythonApplication rec { # Then, add the installed scripts/ directory to the python path --prefix "PYTHONPATH" ":" "$out/lib/${python36Packages.python.libPrefix}/site-packages" + # Add some runtime dependencies + --prefix "PATH" ":" "${stdenv.lib.makeBinPath runTimeDeps}" + # Finally, move to directory that contains data --run "cd $out/share/${pname}" )