14 writeShellApplication,
19 stdenvNoCC.mkDerivation (finalAttrs: {
24 name = "WinBox_Linux-${finalAttrs.version}.zip";
25 url = "https://download.mikrotik.com/routeros/winbox/${finalAttrs.version}/WinBox_Linux.zip";
26 hash = "sha256-129ejj3WxYx5kQTy6EOLtBolhx076yMVb5ymkAoXrwc=";
34 # makeBinaryWrapper does not support --run
47 xorg.xcbutilrenderutil
55 install -Dm644 "assets/img/winbox.png" "$out/share/pixmaps/winbox.png"
56 install -Dm755 "WinBox" "$out/bin/WinBox"
58 wrapProgram "$out/bin/WinBox" --run "${lib.getExe finalAttrs.migrationScript}"
66 desktopName = "Winbox";
67 comment = "GUI administration for Mikrotik RouterOS";
70 categories = [ "Utility" ];
74 migrationScript = writeShellApplication {
75 name = "winbox-migrate";
77 XDG_DATA_HOME=''${XDG_DATA_HOME:-$HOME/.local/share}
78 targetFile="$XDG_DATA_HOME/MikroTik/WinBox/Addresses.cdb"
80 if [ -f "$targetFile" ]; then
81 echo "NixOS: WinBox 4 data already present at $(dirname "$targetFile"). Skipping automatic migration."
85 # cover both wine prefix variants
86 # latter was used until https://github.com/NixOS/nixpkgs/pull/329626 was merged on 2024/07/24
88 "''${WINEPREFIX:-$HOME/.wine}"
89 "''${WINBOX_HOME:-$XDG_DATA_HOME/winbox}/wine"
91 sourceFilePathSuffix="drive_c/users/$USER/AppData/Roaming/Mikrotik/Winbox/Addresses.cdb"
94 for prefix in "''${winePrefixes[@]}"
96 echo "NixOS: Probing WinBox 3 data path at $prefix..."
97 if [ -f "$prefix/$sourceFilePathSuffix" ]; then
98 selectedSourceFile="$prefix/$sourceFilePathSuffix"
103 if [ -z "$selectedSourceFile" ]; then
104 echo "NixOS: WinBox 3 data not found. Skipping automatic migration."
108 echo "NixOS: Automatically migrating WinBox 3 data..."
109 install -Dvm644 "$selectedSourceFile" "$targetFile"
114 description = "Graphical configuration utility for RouterOS-based devices";
115 homepage = "https://mikrotik.com";
116 downloadPage = "https://mikrotik.com/download";
117 changelog = "https://download.mikrotik.com/routeros/winbox/${finalAttrs.version}/CHANGELOG";
118 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
119 license = lib.licenses.unfree;
120 mainProgram = "WinBox";
121 maintainers = with lib.maintainers; [