From 8680a7e0036656d1c8dfb9bfb54f93e27010bf87 Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Fri, 1 Nov 2024 21:20:48 -0700 Subject: [PATCH] Move nix-ecuflash to nix-ecutuner to separate from EcuFlash (not FOSS) --- dotfiles/home-manager/laptop/home.nix | 1 + projects/nix-ecutuner/99-j2534.rules | 1 + .../{nix-ecuflash => nix-ecutuner}/README.md | 0 .../ecuflash.nix | 0 .../{nix-ecuflash => nix-ecutuner}/flake.lock | 0 .../{nix-ecuflash => nix-ecutuner}/flake.nix | 15 +++++++------ projects/nix-ecutuner/j2534.nix | 21 +++++++++++++++++++ 7 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 projects/nix-ecutuner/99-j2534.rules rename projects/{nix-ecuflash => nix-ecutuner}/README.md (100%) rename projects/{nix-ecuflash => nix-ecutuner}/ecuflash.nix (100%) rename projects/{nix-ecuflash => nix-ecutuner}/flake.lock (100%) rename projects/{nix-ecuflash => nix-ecutuner}/flake.nix (57%) create mode 100644 projects/nix-ecutuner/j2534.nix diff --git a/dotfiles/home-manager/laptop/home.nix b/dotfiles/home-manager/laptop/home.nix index 9247bc22..73bc3c54 100644 --- a/dotfiles/home-manager/laptop/home.nix +++ b/dotfiles/home-manager/laptop/home.nix @@ -25,6 +25,7 @@ home.packages = with pkgs; [ git kdePackages.kdeconnect-kde + nix-prefetch ]; programs.home-manager = { enable = true; diff --git a/projects/nix-ecutuner/99-j2534.rules b/projects/nix-ecutuner/99-j2534.rules new file mode 100644 index 00000000..21069e11 --- /dev/null +++ b/projects/nix-ecutuner/99-j2534.rules @@ -0,0 +1 @@ +SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTR{idProduct}=="cc4d", GROUP="dialout", MODE="0666" \ No newline at end of file diff --git a/projects/nix-ecuflash/README.md b/projects/nix-ecutuner/README.md similarity index 100% rename from projects/nix-ecuflash/README.md rename to projects/nix-ecutuner/README.md diff --git a/projects/nix-ecuflash/ecuflash.nix b/projects/nix-ecutuner/ecuflash.nix similarity index 100% rename from projects/nix-ecuflash/ecuflash.nix rename to projects/nix-ecutuner/ecuflash.nix diff --git a/projects/nix-ecuflash/flake.lock b/projects/nix-ecutuner/flake.lock similarity index 100% rename from projects/nix-ecuflash/flake.lock rename to projects/nix-ecutuner/flake.lock diff --git a/projects/nix-ecuflash/flake.nix b/projects/nix-ecutuner/flake.nix similarity index 57% rename from projects/nix-ecuflash/flake.nix rename to projects/nix-ecutuner/flake.nix index 916574d4..63e9c24e 100644 --- a/projects/nix-ecuflash/flake.nix +++ b/projects/nix-ecutuner/flake.nix @@ -1,21 +1,20 @@ { - description = "A Nix flake for EcuFlash"; + description = "A Nix flake with tools for working with ECUs"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; - erosanix.url = "github:emmanuelrosa/erosanix"; }; - outputs = { self, nixpkgs, erosanix }: { + outputs = { self, nixpkgs }: { 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); { + in with pkgs; { default = self.packages.x86_64-linux.ecuflash; - - ecuflash = callPackage ./ecuflash.nix { - inherit mkWindowsAppNoCC; - wine = wineWowPackages.full; + j2534 = callPackage ./j2534.nix { + inherit libusb1 pkg-config; + inherit fetchFromGitHub; + inherit stdenv; }; }; diff --git a/projects/nix-ecutuner/j2534.nix b/projects/nix-ecutuner/j2534.nix new file mode 100644 index 00000000..8503d40a --- /dev/null +++ b/projects/nix-ecutuner/j2534.nix @@ -0,0 +1,21 @@ +{ stdenv, fetchFromGitHub, libusb1, pkg-config }: +stdenv.mkDerivation rec { + pname = "j2534"; + version = "678252b"; + src = fetchFromGitHub { + owner = "dschultzca"; + repo = "j2534"; + rev = "678252bbd0492f48df5e2d94e89cb5485b76d02f"; + sha256 = "sha256-V76NtilaKjiT203lX8J0xGG1AZzdZK8Y66hynlQtqW0="; + }; + dontDisableStatic = true; + buildInputs = [ libusb1 pkg-config ]; + buildPhase = { + makefile = "j2534/makefile"; + }; + installPhase = '' + mkdir -p $out/lib + cp j2534.so $out/lib/${pname}.so + install -D ${./99-j2534.rules} $out/lib/udev/rules.d/99-j2534.rules + ''; +} \ No newline at end of file