From 0a072151f5c64b3d488b67a3dee3344ce57aa52b Mon Sep 17 00:00:00 2001 From: Rutherther Date: Mon, 28 Oct 2024 18:01:52 +0100 Subject: [PATCH] feat: add vitis --- flake.nix | 4 ++ pkgs/xilinx/common.nix | 26 ++++++++++ pkgs/xilinx/vitis/fhs-package.nix | 83 +++++++++++++++++++++++++++++++ pkgs/xilinx/vitis/fhs-shell.nix | 7 +++ pkgs/xilinx/vitis/fhs.nix | 18 +++++++ 5 files changed, 138 insertions(+) create mode 100644 pkgs/xilinx/vitis/fhs-package.nix create mode 100644 pkgs/xilinx/vitis/fhs-shell.nix create mode 100644 pkgs/xilinx/vitis/fhs.nix diff --git a/flake.nix b/flake.nix index 7f807c7..31e681a 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,10 @@ vivado = pkgs.callPackage ./pkgs/xilinx/vivado/fhs-package.nix { inherit myLib; }; vivado-udev-rules = pkgs.callPackage ./pkgs/xilinx/vivado/udev.nix {}; + vitis-shell = pkgs.callPackage ./pkgs/xilinx/vitis/fhs-shell.nix { inherit myLib; }; + vitis = pkgs.callPackage ./pkgs/xilinx/vitis/fhs-package.nix { inherit myLib; }; + vitis-udev-rules = pkgs.callPackage ./pkgs/xilinx/vitis/udev.nix {}; + ise-shell = pkgs.callPackage ./pkgs/xilinx/ise/fhs-shell.nix { inherit myLib; ise-usb-driver = self.packages.${system}.ise-usb-driver; diff --git a/pkgs/xilinx/common.nix b/pkgs/xilinx/common.nix index cfe6d27..83541fe 100644 --- a/pkgs/xilinx/common.nix +++ b/pkgs/xilinx/common.nix @@ -1,5 +1,6 @@ { targetPkgs = pkgs: with pkgs; [ + bash gnumake coreutils stdenv.cc.cc @@ -20,6 +21,7 @@ glibc.dev fontconfig liberation_ttf + lsb-release # Xilinx ISE glib @@ -37,5 +39,29 @@ xorg.libXrandr xorg.libSM xorg.libICE + + # to compile some xilinx examples + opencl-clhpp + ocl-icd + opencl-headers + + # Vitis + python3 + swt + (pkgs.runCommandLocal "swt-4" {} '' + mkdir -p $out/lib + ln -s ${swt}/lib/libswt-pi-gtk-4527.so $out/lib/libswt-pi4-gtk.so + '') + gtk3 + jdk21 + xorg.xlsclients + + # Debug + strace + + # "arch" is needed for vitis + toybox + unzip + (lib.hiPrio gcc) ]; } diff --git a/pkgs/xilinx/vitis/fhs-package.nix b/pkgs/xilinx/vitis/fhs-package.nix new file mode 100644 index 0000000..047f18a --- /dev/null +++ b/pkgs/xilinx/vitis/fhs-package.nix @@ -0,0 +1,83 @@ +{ pkgs, myLib }: + +myLib.finalPkgGenerator.override { + mainProgram = "vitis"; + + fhsEnv = pkgs.callPackage ./fhs.nix { inherit myLib; requireInstallDir = true; }; + + executables = [ + # From Vivado bin folder + "cdoutil_int" + "combine_dfx_bitstreams" + "cs_server" + "diffbd" + "hw_server" + "hw_serverpv" + "ldlibpath.sh" + "loader" + "manage_ipcache" + "program_ftdi" + "rdiArgs.sh" + "setEnvAndRunCmd.sh" + "setupEnv.sh" + "stapl_player" + "svf_utility" + "symbol_server" + "tcflog" + "unsetldlibpath.sh" + "unwrapped" + "updatemem" + "vivado" + "vlm" + "wbtcv" + "xar" + "xcd" + "xcrg" + "xelab" + "xlicdiag" + "xrcserver" + "xrt_server" + "xsc" + "xsdb" + "xsim" + "xtclsh" + "xvc_pcie" + "xvhdl" + "xvlog" + + # From Vitis bin folder + "apcc" + "hlsArgs.sh" + "ldlibpath.sh" + "loader" + "rdiArgs.sh" + "setEnvAndRunCmd.sh" + "setupEnv.sh" + "unsetldlibpath.sh" + "unwrapped" + "vitis_hls" + "vitis" + "xlicdiag" + + # From ModelComposer bin folder + "ldlibpath.sh" + "loader" + "model_composer" + "modelcomposerArgs.sh" + "rdiArgs.sh" + "setEnvAndRunCmd.sh" + "setPatchEnv.sh" + "setupEnv.sh" + "unsetldlibpath.sh" + "unwrapped" + + # From DocNav bin folder + "AppRun" + "docnav" + "lib" + "libexec" + "pdfjs" + "plugins" + "translations" + ]; +} diff --git a/pkgs/xilinx/vitis/fhs-shell.nix b/pkgs/xilinx/vitis/fhs-shell.nix new file mode 100644 index 0000000..976dd80 --- /dev/null +++ b/pkgs/xilinx/vitis/fhs-shell.nix @@ -0,0 +1,7 @@ +{ pkgs, lib, myLib }: + +let + fhs = pkgs.callPackage ./fhs.nix { inherit myLib; }; +in pkgs.writeShellScriptBin "vitis-shell" '' + exec ${lib.getExe fhs} bash "$@" +'' diff --git a/pkgs/xilinx/vitis/fhs.nix b/pkgs/xilinx/vitis/fhs.nix new file mode 100644 index 0000000..0f8afd6 --- /dev/null +++ b/pkgs/xilinx/vitis/fhs.nix @@ -0,0 +1,18 @@ +{ pkgs, myLib, requireInstallDir ? false, ... }: + +pkgs.buildFHSEnv { + targetPkgs = (import ../common.nix).targetPkgs; + + name = "vitis"; + + runScript = '' + ${myLib.runScriptPrefix "vitis" requireInstallDir} + if [[ ! -z $INSTALL_DIR ]]; then + source $INSTALL_DIR/settings64.sh $INSTALL_DIR + fi + export LD_LIBRARY_PATH=/lib:$LD_LIBRARY_PATH + exec "$@" + ''; + + meta.mainProgram = "vitis"; +} -- 2.48.1