2020-05-01 13:00:00 +01:00
|
|
|
{ fetchFromGitHub, libxcb, mtools, p7zip, parted, procps, qemu, unzip, zip,
|
|
|
|
coreutils, gnugrep, which, gnused, e2fsprogs, autoPatchelfHook, gptfdisk,
|
2021-10-02 23:53:07 +01:00
|
|
|
python3Packages, qt5, runtimeShell, lib, util-linux, wrapQtAppsHook }:
|
2019-11-15 17:31:15 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2021-10-02 23:53:07 +01:00
|
|
|
python3Packages.buildPythonApplication rec {
|
2018-05-08 19:03:14 +01:00
|
|
|
pname = "multibootusb";
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
version = "9.2.0";
|
|
|
|
|
2019-11-15 17:31:15 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
wrapQtAppsHook
|
2020-05-01 13:00:00 +01:00
|
|
|
autoPatchelfHook
|
|
|
|
unzip
|
|
|
|
zip
|
2019-11-15 17:31:15 +00:00
|
|
|
];
|
|
|
|
|
2020-05-01 13:00:00 +01:00
|
|
|
runTimeDeps = [
|
|
|
|
coreutils
|
|
|
|
gnugrep
|
|
|
|
which
|
2018-05-08 19:03:14 +01:00
|
|
|
parted
|
2020-11-24 15:29:28 +00:00
|
|
|
util-linux
|
2020-05-01 13:00:00 +01:00
|
|
|
qemu
|
|
|
|
p7zip
|
|
|
|
gnused
|
|
|
|
mtools
|
2018-05-08 19:03:14 +01:00
|
|
|
procps
|
2020-05-01 13:00:00 +01:00
|
|
|
e2fsprogs
|
|
|
|
gptfdisk
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libxcb
|
2021-10-02 23:53:07 +01:00
|
|
|
python3Packages.python
|
2018-05-08 19:03:14 +01:00
|
|
|
qt5.full
|
|
|
|
];
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mbusb";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
|
|
|
|
sha256 = "0wlan0cp6c2i0nahixgpmkm0h4n518gj8rc515d579pqqp91p2h3";
|
|
|
|
};
|
|
|
|
|
2019-11-15 17:31:15 +00:00
|
|
|
# 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;
|
|
|
|
|
2021-10-02 23:53:07 +01:00
|
|
|
pythonPath = with python3Packages; [
|
|
|
|
dbus-python
|
|
|
|
pyqt5
|
|
|
|
pytest-shutil
|
|
|
|
pyudev
|
|
|
|
six
|
2019-11-15 17:31:15 +00:00
|
|
|
];
|
|
|
|
|
2020-05-01 13:00:00 +01:00
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
|
2019-11-15 17:31:15 +00:00
|
|
|
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"
|
2018-05-08 19:03:14 +01:00
|
|
|
'';
|
|
|
|
|
2019-12-10 23:23:57 +00:00
|
|
|
preFixup = ''
|
|
|
|
makeWrapperArgs+=(
|
|
|
|
# Firstly, add all necessary QT variables
|
|
|
|
"''${qtWrapperArgs[@]}"
|
|
|
|
|
|
|
|
# Then, add the installed scripts/ directory to the python path
|
2021-10-02 23:53:07 +01:00
|
|
|
--prefix "PYTHONPATH" ":" "$out/lib/${python3Packages.python.libPrefix}/site-packages"
|
2019-12-10 23:23:57 +00:00
|
|
|
|
2020-05-01 13:00:00 +01:00
|
|
|
# Add some runtime dependencies
|
2021-01-15 05:42:41 +00:00
|
|
|
--prefix "PATH" ":" "${lib.makeBinPath runTimeDeps}"
|
2020-05-01 13:00:00 +01:00
|
|
|
|
2019-12-10 23:23:57 +00:00
|
|
|
# Finally, move to directory that contains data
|
|
|
|
--run "cd $out/share/${pname}"
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2018-05-08 19:03:14 +01:00
|
|
|
description = "Multiboot USB creator for Linux live disks";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://multibootusb.org/";
|
2018-05-08 19:03:14 +01:00
|
|
|
license = licenses.gpl2;
|
2019-11-15 17:31:15 +00:00
|
|
|
maintainers = []; # Looking for a maintainer!
|
2021-02-06 10:17:20 +00:00
|
|
|
broken = true; # "name 'config' is not defined", added 2021-02-06
|
2018-05-08 19:03:14 +01:00
|
|
|
};
|
|
|
|
}
|