27 , withCryptsetup ? false
36 assert lib.elem defaultGuiType [ "" "gtk3" "qt5" ];
37 assert defaultGuiType == "gtk3" -> withGtk3;
38 assert defaultGuiType == "qt5" -> withQt5;
41 inherit (lib) optional optionalString;
42 inherit (libsForQt5) qtbase wrapQtAppsHook;
44 x86_64-linux = "x86_64";
46 aarch64-linux = "aarch64";
47 mipsel-linux = "mips64el";
48 }.${stdenv.hostPlatform.system}
49 or (throw "Unsupported platform ${stdenv.hostPlatform.system}");
51 stdenv.mkDerivation (finalAttrs: {
57 inherit (finalAttrs) version;
60 url = "https://github.com/ventoy/Ventoy/releases/download/v${version}/ventoy-${version}-linux.tar.gz";
61 hash = "sha256-eUpxfJQ0u3bpAXTUCKlMO/ViwKcBI59YFKJ3xGzSdcg=";
65 ./000-nixos-sanitization.patch
70 find -type f -name \*.sh -exec chmod a+x '{}' \;
73 sed -i 's:log\.txt:/var/log/ventoy\.log:g' \
74 WebUI/static/js/languages.js tool/languages.json
81 ++ optional (withQt5 || withGtk3) copyDesktopItems
82 ++ optional withQt5 wrapQtAppsHook;
99 ++ optional withCryptsetup cryptsetup
100 ++ optional withExt4 e2fsprogs
101 ++ optional withGtk3 gtk3
102 ++ optional withNtfs ntfs3g
103 ++ optional withXfs xfsprogs
104 ++ optional withQt5 qtbase;
109 desktopName = "Ventoy";
110 comment = "Tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files";
114 categories = [ "Utility" ];
115 startupNotify = true;
119 dontConfigure = true;
126 local VENTOY_PATH="$out"/share/ventoy
131 rm ash* hexdump* mkexfatfs* mount.exfat-fuse* xzcat*
132 for archive in *.xz; do
133 xzcat "$archive" > "''${archive%.xz}"
141 x86_64) rm -r {tool/,VentoyGUI.}{i386,aarch64,mips64el};;
142 i386) rm -r {tool/,VentoyGUI.}{x86_64,aarch64,mips64el};;
143 aarch64) rm -r {tool/,VentoyGUI.}{x86_64,i386,mips64el};;
144 mips64el) rm -r {tool/,VentoyGUI.}{x86_64,i386,aarch64};;
147 rm tool/"$ARCH"/Ventoy2Disk.gtk2 || true # For aarch64 and mips64el.
149 # Copy from "$src" to "$out"
150 mkdir -p "$out"/bin "$VENTOY_PATH"
151 cp -r . "$VENTOY_PATH"
154 for f in Ventoy2Disk.sh_ventoy VentoyWeb.sh_ventoy-web \
155 CreatePersistentImg.sh_ventoy-persistent \
156 ExtendPersistentImg.sh_ventoy-extend-persistent \
157 VentoyPlugson.sh_ventoy-plugson; do
158 local bin="''${f%_*}" wrapper="''${f#*_}"
159 makeWrapper "$VENTOY_PATH/$bin" "$out/bin/$wrapper" \
160 --prefix PATH : "${lib.makeBinPath finalAttrs.buildInputs}" \
161 --chdir "$VENTOY_PATH"
164 # VentoGUI uses the `ventoy_gui_type` file to determine the type of GUI.
165 # See: https://github.com/ventoy/Ventoy/blob/v1.0.78/LinuxGUI/Ventoy2Disk/ventoy_gui.c#L1096
166 + optionalString (withGtk3 || withQt5) ''
167 echo "${defaultGuiType}" > "$VENTOY_PATH/ventoy_gui_type"
168 makeWrapper "$VENTOY_PATH/VentoyGUI.$ARCH" "$out/bin/ventoy-gui" \
169 --prefix PATH : "${lib.makeBinPath finalAttrs.buildInputs}" \
170 --chdir "$VENTOY_PATH"
171 mkdir "$out"/share/{applications,pixmaps}
172 ln -s "$VENTOY_PATH"/WebUI/static/img/VentoyLogo.png "$out"/share/pixmaps/
174 + optionalString (!withGtk3) ''
175 rm "$VENTOY_PATH"/tool/{"$ARCH"/Ventoy2Disk.gtk3,VentoyGTK.glade}
177 + optionalString (!withQt5) ''
178 rm "$VENTOY_PATH/tool/$ARCH/Ventoy2Disk.qt5"
180 + optionalString (!withGtk3 && !withQt5) ''
181 rm "$VENTOY_PATH"/VentoyGUI.*
189 homepage = "https://www.ventoy.net";
190 description = "A New Bootable USB Solution";
192 Ventoy is an open source tool to create bootable USB drive for
193 ISO/WIM/IMG/VHD(x)/EFI files. With ventoy, you don't need to format the
194 disk over and over, you just need to copy the ISO/WIM/IMG/VHD(x)/EFI files
195 to the USB drive and boot them directly. You can copy many files at a time
196 and ventoy will give you a boot menu to select them. You can also browse
197 ISO/WIM/IMG/VHD(x)/EFI files in local disk and boot them. x86 Legacy
198 BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI are supported
199 in the same way. Most type of OS supported
200 (Windows/WinPE/Linux/ChromeOS/Unix/VMware/Xen...). With ventoy you can
201 also browse ISO/WIM/IMG/VHD(x)/EFI files in local disk and boot them.
202 800+ image files are tested. 90%+ distros in DistroWatch supported.
204 changelog = "https://www.ventoy.net/doc_news.html";
205 license = lib.licenses.gpl3Plus;
206 maintainers = with lib.maintainers; [ AndersonTorres ];
207 platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "mipsel-linux" ];
208 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];