summary refs log tree commit diff
path: root/pkgs/applications/misc/multibootusb/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/misc/multibootusb/default.nix')
-rw-r--r--pkgs/applications/misc/multibootusb/default.nix43
1 files changed, 37 insertions, 6 deletions
diff --git a/pkgs/applications/misc/multibootusb/default.nix b/pkgs/applications/misc/multibootusb/default.nix
index 5225f88094f..8f90c7a581d 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
   ];
 
-  buildInputs = [
-    libxcb
-    mtools
-    p7zip
+  runTimeDeps = [
+    coreutils
+    gnugrep
+    which
     parted
+    utillinux
+    qemu
+    p7zip
+    gnused
+    mtools
     procps
+    e2fsprogs
+    gptfdisk
+  ];
+
+  buildInputs = [
+    libxcb
     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}"
     )