summary refs log tree commit diff
path: root/pkgs/applications/misc/multibootusb
diff options
context:
space:
mode:
authorjD91mZM2 <me@krake.one>2019-11-15 18:31:15 +0100
committerBjørn Forsman <bjorn.forsman@gmail.com>2019-11-16 11:14:57 +0100
commit227c4c8b0b0d5e4f3d992fec4c5377d2fd6f75f5 (patch)
tree6065a87bf0988b682367ea29bd38f1e64913f82a /pkgs/applications/misc/multibootusb
parent9c691e6fd72f9ac8272e5b92e49ae96377eb5516 (diff)
downloadnixpkgs-227c4c8b0b0d5e4f3d992fec4c5377d2fd6f75f5.tar
nixpkgs-227c4c8b0b0d5e4f3d992fec4c5377d2fd6f75f5.tar.gz
nixpkgs-227c4c8b0b0d5e4f3d992fec4c5377d2fd6f75f5.tar.bz2
nixpkgs-227c4c8b0b0d5e4f3d992fec4c5377d2fd6f75f5.tar.lz
nixpkgs-227c4c8b0b0d5e4f3d992fec4c5377d2fd6f75f5.tar.xz
nixpkgs-227c4c8b0b0d5e4f3d992fec4c5377d2fd6f75f5.tar.zst
nixpkgs-227c4c8b0b0d5e4f3d992fec4c5377d2fd6f75f5.zip
multibootusb: Fix QT and refactor
Also removed myself as maintainer because I don't care about this
software anymore.
Diffstat (limited to 'pkgs/applications/misc/multibootusb')
-rw-r--r--pkgs/applications/misc/multibootusb/default.nix78
1 files changed, 50 insertions, 28 deletions
diff --git a/pkgs/applications/misc/multibootusb/default.nix b/pkgs/applications/misc/multibootusb/default.nix
index a2678d6067f..14201483294 100644
--- a/pkgs/applications/misc/multibootusb/default.nix
+++ b/pkgs/applications/misc/multibootusb/default.nix
@@ -1,21 +1,33 @@
-{ stdenv, python36Packages, fetchFromGitHub, libxcb, mtools, p7zip, parted, procps, utillinux, qt5, runtimeShell }:
+{ fetchFromGitHub, libxcb, mtools, p7zip, parted, procps,
+  python36Packages, qt5, runtimeShell, stdenv, utillinux, wrapQtAppsHook }:
+
+# Note: Multibootusb is tricky to maintain. It relies on the
+# $PYTHONPATH variable containing some of their code, so that
+# something like:
+#
+# from scripts import config
+#
+# works. It also relies on the current directory to find some runtime
+# resources thanks to a use of __file__.
+#
+# https://github.com/mbusb/multibootusb/blob/0d34d70c3868f1d7695cfd141141b17c075de967/scripts/osdriver.py#L59
+
 python36Packages.buildPythonApplication rec {
   pname = "multibootusb";
   name = "${pname}-${version}";
   version = "9.2.0";
 
+  nativeBuildInputs = [
+    wrapQtAppsHook
+  ];
+
   buildInputs = [
-    python36Packages.dbus-python
-    python36Packages.pyqt5
-    python36Packages.pytest-shutil
-    python36Packages.python
-    python36Packages.pyudev
-    python36Packages.six
     libxcb
     mtools
     p7zip
     parted
     procps
+    python36Packages.python
     qt5.full
     utillinux
   ];
@@ -28,32 +40,42 @@ python36Packages.buildPythonApplication rec {
     sha256 = "0wlan0cp6c2i0nahixgpmkm0h4n518gj8rc515d579pqqp91p2h3";
   };
 
-  # Skip the fixup stage where stuff is shrinked (can't shrink text files)
-  phases = [ "unpackPhase" "installPhase" ];
-
-  installPhase = ''
-    share="$out/share/${pname}"
-    mkdir -p "$share"
-    cp -r data "$share/data"
-    cp -r scripts "$share/scripts"
-    cp "${pname}" "$share/${pname}"
-
-    mkdir "$out/bin"
-    cat > "$out/bin/${pname}" <<EOF
-      #!${runtimeShell}
-      cd "$share"
-      export PYTHONPATH="$PYTHONPATH:$share"
-      export PATH="$PATH:${parted}/bin:${procps}/bin"
-
-      "${python36Packages.python}/bin/python" "${pname}"
-    EOF
-    chmod +x "$out/bin/${pname}"
+  # Tests can't run inside the NixOS sandbox
+  # "Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory"
+  doCheck = false;
+
+  pythonPath = [
+    python36Packages.dbus-python
+    python36Packages.pyqt5
+    python36Packages.pytest-shutil
+    python36Packages.pyudev
+    python36Packages.six
+  ];
+
+  makeWrapperArgs = [
+    # Firstly, add all necessary QT variables
+    "\${qtWrapperArgs[@]}"
+
+    # Then, add the installed scripts/ directory to the python path
+    "--prefix" "PYTHONPATH" ":" "$out/lib/${python36Packages.python.libPrefix}/site-packages"
+
+    # Finally, move to directory that contains data
+    "--run" "\"cd $out/share/${pname}\""
+  ];
+
+  postInstall = ''
+    # This script doesn't work and it doesn't add much anyway
+    rm $out/bin/multibootusb-pkexec
+
+    # The installed data isn't sufficient for whatever reason, missing gdisk/gdisk.exe
+    mkdir -p "$out/share/${pname}"
+    cp -r data "$out/share/${pname}/data"
   '';
 
   meta = with stdenv.lib; {
     description = "Multiboot USB creator for Linux live disks";
     homepage = http://multibootusb.org/;
     license = licenses.gpl2;
-    maintainers = with maintainers; [ jD91mZM2 ];
+    maintainers = []; # Looking for a maintainer!
   };
 }