27 , withCryptsetup ? false
36 assert lib.elem defaultGuiType [ "" "gtk3" "qt5" ];
37 assert defaultGuiType == "gtk3" -> withGtk3;
38 assert defaultGuiType == "qt5" -> withQt5;
41 inherit (lib) optionals 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: {
56 url = "https://github.com/ventoy/Ventoy/releases/download/v${finalAttrs.version}/ventoy-${finalAttrs.version}-linux.tar.gz";
57 hash = "sha256-RnzdGIp/c5vHBq28HWlfYf/e/JWRatsBWUfYCCnwCj0=";
61 ./000-nixos-sanitization.patch
66 find -type f -name \*.sh -exec chmod a+x '{}' \;
69 sed -i 's:log\.txt:/var/log/ventoy\.log:g' \
70 WebUI/static/js/languages.js tool/languages.json
77 ++ optionals (withQt5 || withGtk3) [ copyDesktopItems ]
78 ++ optionals withQt5 [ wrapQtAppsHook ];
95 ++ optionals withCryptsetup [ cryptsetup ]
96 ++ optionals withExt4 [ e2fsprogs ]
97 ++ optionals withGtk3 [ gtk3 ]
98 ++ optionals withNtfs [ ntfs3g ]
99 ++ optionals withXfs [ xfsprogs ]
100 ++ optionals withQt5 [ qtbase ];
107 desktopName = "Ventoy";
108 comment = "Tool to create bootable USB drive for ISO/WIM/IMG/VHD(x)/EFI files";
112 categories = [ "Utility" ];
113 startupNotify = true;
117 dontConfigure = true;
124 local VENTOY_PATH="$out"/share/ventoy
129 rm ash* hexdump* mkexfatfs* mount.exfat-fuse* xzcat*
130 for archive in *.xz; do
131 xzcat "$archive" > "''${archive%.xz}"
139 x86_64) rm -r {tool/,VentoyGUI.}{i386,aarch64,mips64el};;
140 i386) rm -r {tool/,VentoyGUI.}{x86_64,aarch64,mips64el};;
141 aarch64) rm -r {tool/,VentoyGUI.}{x86_64,i386,mips64el};;
142 mips64el) rm -r {tool/,VentoyGUI.}{x86_64,i386,aarch64};;
145 rm tool/"$ARCH"/Ventoy2Disk.gtk2 || true # For aarch64 and mips64el.
147 # Copy from "$src" to "$out"
148 mkdir -p "$out"/bin "$VENTOY_PATH"
149 cp -r . "$VENTOY_PATH"
152 for f in Ventoy2Disk.sh_ventoy VentoyWeb.sh_ventoy-web \
153 CreatePersistentImg.sh_ventoy-persistent \
154 ExtendPersistentImg.sh_ventoy-extend-persistent \
155 VentoyPlugson.sh_ventoy-plugson; do
156 local bin="''${f%_*}" wrapper="''${f#*_}"
157 makeWrapper "$VENTOY_PATH/$bin" "$out/bin/$wrapper" \
158 --prefix PATH : "${lib.makeBinPath finalAttrs.buildInputs}" \
159 --chdir "$VENTOY_PATH"
162 # VentoGUI uses the `ventoy_gui_type` file to determine the type of GUI.
163 # See: https://github.com/ventoy/Ventoy/blob/v1.0.78/LinuxGUI/Ventoy2Disk/ventoy_gui.c#L1096
164 + optionalString (withGtk3 || withQt5) ''
165 echo "${defaultGuiType}" > "$VENTOY_PATH/ventoy_gui_type"
166 makeWrapper "$VENTOY_PATH/VentoyGUI.$ARCH" "$out/bin/ventoy-gui" \
167 --prefix PATH : "${lib.makeBinPath finalAttrs.buildInputs}" \
168 --chdir "$VENTOY_PATH"
169 mkdir "$out"/share/{applications,pixmaps}
170 ln -s "$VENTOY_PATH"/WebUI/static/img/VentoyLogo.png "$out"/share/pixmaps/
172 + optionalString (!withGtk3) ''
173 rm "$VENTOY_PATH"/tool/{"$ARCH"/Ventoy2Disk.gtk3,VentoyGTK.glade}
175 + optionalString (!withQt5) ''
176 rm "$VENTOY_PATH/tool/$ARCH/Ventoy2Disk.qt5"
178 + optionalString (!withGtk3 && !withQt5) ''
179 rm "$VENTOY_PATH"/VentoyGUI.*
187 homepage = "https://www.ventoy.net";
188 description = "New Bootable USB Solution";
190 Ventoy is an open source tool to create bootable USB drive for
191 ISO/WIM/IMG/VHD(x)/EFI files. With ventoy, you don't need to format the
192 disk over and over, you just need to copy the ISO/WIM/IMG/VHD(x)/EFI files
193 to the USB drive and boot them directly. You can copy many files at a time
194 and ventoy will give you a boot menu to select them. You can also browse
195 ISO/WIM/IMG/VHD(x)/EFI files in local disk and boot them. x86 Legacy
196 BIOS, IA32 UEFI, x86_64 UEFI, ARM64 UEFI and MIPS64EL UEFI are supported
197 in the same way. Most type of OS supported
198 (Windows/WinPE/Linux/ChromeOS/Unix/VMware/Xen...). With ventoy you can
199 also browse ISO/WIM/IMG/VHD(x)/EFI files in local disk and boot them.
200 800+ image files are tested. 90%+ distros in DistroWatch supported.
202 changelog = "https://www.ventoy.net/doc_news.html";
203 license = lib.licenses.gpl3Plus;
204 mainProgram = "ventoy";
205 maintainers = with lib.maintainers; [ AndersonTorres ];
206 platforms = [ "x86_64-linux" "i686-linux" "aarch64-linux" "mipsel-linux" ];
207 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];