diff --git a/projects/nix-ecuflash/README.md b/projects/nix-ecuflash/README.md new file mode 100644 index 00000000..bbfc1eb4 --- /dev/null +++ b/projects/nix-ecuflash/README.md @@ -0,0 +1,10 @@ +# A Nix Package for Tactrix EcuFlash +> EcuFlash is a general-purpose ECU reflashing and editing tool that supports an [ever-growing list](http://openecu.org/index.php?title=EcuFlash:VehicleSupport) of vehicles. EcuFlash uses the [OpenPort](http://openecu.org/index.php?title=OpenPort) vehicle interface to reflash vehicles via the [OBDII port](http://en.wikipedia.org/wiki/On_Board_Diagnostics). EcuFlash also allows you to edit ECU data (known as 'maps' or 'tables') in a human-readable format using a [XML-based](http://en.wikipedia.org/wiki/XML) definition system to translate the data. With properly setup definitions, the ROM from any vehicle can be edited. Future plans for EcuFlash include logging support / overlay, and live tuning. + +- [Tactrix.com](https://www.tactrix.com/index.php?option=com_content&view=category&layout=blog&id=36&Itemid=57) + +This project attempts to create a reproducible package for running Tactrix' Windows-only software on Linux. + +# Installation + + \ No newline at end of file diff --git a/projects/nix-ecuflash/ecuflash.nix b/projects/nix-ecuflash/ecuflash.nix new file mode 100644 index 00000000..ab708953 --- /dev/null +++ b/projects/nix-ecuflash/ecuflash.nix @@ -0,0 +1,71 @@ +{ lib +, mkWindowsAppNoCC +, wine +, makeDesktopItem +, copyDesktopItems +}: mkWindowsAppNoCC rec { + inherit wine; + + pname = "ecuflash"; + version = "1.44"; + version_raw = "1444870"; + + src = builtins.fetchurl { + sha256 = "sha256-6SQtiIJTD8MgFk8T5BB87/nIYvW9Lmbevb6+SJX/+gs="; + url = "https://www.tactrix.com/downloads/ecuflash_1444870_win.exe"; + }; + dontUnpack = true; + wineArch = "win64"; + enableInstallNotification = true; + + fileMapDuringAppInstall = false; + persistRegistry = true; + persistRuntimeLayer = true; + inputHashMethod = "store-path"; + nativeBuildInputs = [ copyDesktopItems ]; + winAppInstall = '' + d="$WINEPREFIX/drive_c/Program Files (x86)/OpenECU/${pname}/" + config_dir="$HOME/.config/ecuflash" + + mkdir -p "$d" + cp ${src} "$d/${pname}_${version_raw}.exe" + wine "$WINEPREFIX/drive_c/Program Files (x86)/OpenECU/${pname}/${pname}_${version_raw}.exe" + + mkdir -p "$config_dir" + ''; + winAppPreRun = '' + ''; + winAppRun = '' + echo "src: ${src}" + ls "$WINEPREFIX/drive_c/Program Files (x86)/OpenECU/${pname}" + wine "$WINEPREFIX/drive_c/Program Files (x86)/OpenECU/EcuFlash/${pname}.exe" + ''; + winAppPostRun = ""; + installPhase = '' + runHook preInstall + + ln -s $out/bin/.launcher $out/bin/${pname} + + runHook postInstall + ''; + desktopItems = makeDesktopItem { + name = pname; + exec = pname; + icon = pname; + mimeTypes = [ "application/octet-stream" ]; + desktopName = "EcuFlash"; + genericName = "ROM Editor"; + categories = [ "Development" "Electronics" "Java" ]; + }; + meta = with lib; { + description = "EcuFlash is Tactrix' free software used with the Openport 2.0 to give you the power to tune and reflash many Subaru and Mitsubishi vehicles."; + homepage = "https://www.tactrix.com/"; + license = { + url = "https://www.tactrix.com/index.php?option=com_content&view=article&id=79:eula&catid=36:downloads-ecuflash&Itemid=57"; + free = false; + redistributable = true; + }; + maintainers = with maintainers; [ jafner ]; + platforms = [ "x86_64-linux" ]; + }; +} \ No newline at end of file diff --git a/projects/nix-ecuflash/flake.lock b/projects/nix-ecuflash/flake.lock new file mode 100644 index 00000000..18c714f1 --- /dev/null +++ b/projects/nix-ecuflash/flake.lock @@ -0,0 +1,79 @@ +{ + "nodes": { + "erosanix": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1730470491, + "narHash": "sha256-vh8DM+5/BhqZXzqB99CCeqNo01pzzYTY8COq+5ptXUs=", + "owner": "emmanuelrosa", + "repo": "erosanix", + "rev": "8f79749eef7becb102342d37e9689cde1dfcee42", + "type": "github" + }, + "original": { + "owner": "emmanuelrosa", + "repo": "erosanix", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1729776892, + "narHash": "sha256-NGTJbX/zKE1GfUlcqc/lgvvZxiUvWk9s9A1rFeZJyPE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2aa5b5d837e7cabe4c6632c27f8b005465539f08", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1730327045, + "narHash": "sha256-xKel5kd1AbExymxoIfQ7pgcX6hjw9jCgbiBjiUfSVJ8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "080166c15633801df010977d9d7474b4a6c549d7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "erosanix": "erosanix", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/projects/nix-ecuflash/flake.nix b/projects/nix-ecuflash/flake.nix new file mode 100644 index 00000000..916574d4 --- /dev/null +++ b/projects/nix-ecuflash/flake.nix @@ -0,0 +1,29 @@ +{ + description = "A Nix flake for EcuFlash"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + erosanix.url = "github:emmanuelrosa/erosanix"; + }; + outputs = { self, nixpkgs, erosanix }: { + packages.x86_64-linux = let + pkgs = import "${nixpkgs}" { + system = "x86_64-linux"; + }; + in with (pkgs // erosanix.packages.x86_64-linux // erosanix.lib.x86_64-linux); { + default = self.packages.x86_64-linux.ecuflash; + + ecuflash = callPackage ./ecuflash.nix { + inherit mkWindowsAppNoCC; + wine = wineWowPackages.full; + }; + }; + + apps.x86_64-linux.ecuflash = { + type = "app"; + program = "${self.packages.x86_64-linux.ecuflash}/bin/ecuflash"; + }; + + apps.x86_64-linux.default = self.apps.x86_64-linux.ecuflash; + }; +} \ No newline at end of file