~ruther/nix-fpga

a9e4e49ebb7a14bc5d564f96c181d7d01a00a950 — Rutherther 1 year, 12 days ago e1921e0
feat: add usb-driver to ISE
M flake.nix => flake.nix +3 -2
@@ 27,17 27,18 @@

        ise-shell = pkgs.callPackage ./pkgs/xilinx/ise/fhs-shell.nix {
          inherit myLib;
          ise-fw = self.packages.${system}.ise-fw;
          ise-usb-driver = self.packages.${system}.ise-usb-driver;
        };
        ise = pkgs.callPackage ./pkgs/xilinx/ise/fhs-package.nix {
          inherit myLib;
          ise-fw = self.packages.${system}.ise-fw;
          ise-usb-driver = self.packages.${system}.ise-usb-driver;
        };
        ise-udev-rules = pkgs.callPackage ./pkgs/xilinx/ise/udev.nix {
          inherit myLib;
          ise-fw = self.packages.${system}.ise-fw;
        };
        ise-fw = pkgs.callPackage ./pkgs/xilinx/ise/fw.nix { inherit myLib; };
        ise-usb-driver = pkgs.callPackage ./pkgs/xilinx/ise/usb-driver.nix {};
      };
    };
}

M pkgs/xilinx/ise/fhs-package.nix => pkgs/xilinx/ise/fhs-package.nix +2 -2
@@ 1,9 1,9 @@
{ pkgs, myLib, ise-fw, ... }:
{ pkgs, myLib, ise-fw, ise-usb-driver, ... }:

myLib.finalPkgGenerator.override {
  mainProgram = "ise";

  fhsEnv = pkgs.callPackage ./fhs.nix { inherit myLib ise-fw; requireInstallDir = true; };
  fhsEnv = pkgs.callPackage ./fhs.nix { inherit myLib ise-fw ise-usb-driver; requireInstallDir = true; };

  executables = [
    # TODO

M pkgs/xilinx/ise/fhs-shell.nix => pkgs/xilinx/ise/fhs-shell.nix +2 -2
@@ 1,7 1,7 @@
{ pkgs, lib, myLib, ise-fw, ... }:
{ pkgs, lib, myLib, ise-fw, ise-usb-driver, ... }:

let
  fhs = pkgs.callPackage ./fhs.nix {  inherit myLib ise-fw; };
  fhs = pkgs.callPackage ./fhs.nix {  inherit myLib ise-fw ise-usb-driver; };
in pkgs.writeShellScriptBin "ise-shell" ''
  exec ${lib.getExe fhs} bash "$@"
''

M pkgs/xilinx/ise/fhs.nix => pkgs/xilinx/ise/fhs.nix +3 -4
@@ 1,9 1,7 @@
{ pkgs, myLib, ise-fw, requireInstallDir ? false, ... }:
{ pkgs, myLib, ise-usb-driver, requireInstallDir ? false, ... }:

pkgs.buildFHSEnv {
  targetPkgs = pkgs: ((import ../common.nix).targetPkgs pkgs) ++ [
    ise-fw
  ];
  targetPkgs = (import ../common.nix).targetPkgs;

  name = "ise";



@@ 13,6 11,7 @@ pkgs.buildFHSEnv {
      source $INSTALL_DIR/settings64.sh "$INSTALL_DIR"
    fi
    export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH
    export LD_PRELOAD=${ise-usb-driver}/lib/libusb-driver.so
    exec "$@"
  '';


A pkgs/xilinx/ise/usb-driver.nix => pkgs/xilinx/ise/usb-driver.nix +21 -0
@@ 0,0 1,21 @@
{ fetchgit, multiStdenv, stdenv, libusb, libftdi, ... }:

multiStdenv.mkDerivation {
  name = "ise-usb-driver";

  buildInputs = [
    libusb
    libftdi
  ];

  installPhase = ''
    mkdir -p $out/lib
    mv libusb-driver.so $out/lib/
  '';

  src = fetchgit {
    url = "git://git.zerfleddert.de/usb-driver";
    rev = "2d19c7cb325c8cd15b252dd5b8de7a643bb5295d";
    hash = "sha256-VQEnIuaEW1Kg0O9AYKs8hJKrNTVnOpzVIaFVDjn1Bpg=";
  };
}

Do not follow this link