From af2287b22f43858d08e0bd93192356c17ef35a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Bourdeauducq?= Date: Thu, 6 Jun 2024 14:40:33 +0800 Subject: [PATCH] add back missing dependencies --- gluelogic/default.nix | 12 +++--- gluelogic/fpgatools.nix | 84 +++++++++++++++++++++++++++++++++++++++++ gluelogic/ise.nix | 31 --------------- 3 files changed, 90 insertions(+), 37 deletions(-) create mode 100644 gluelogic/fpgatools.nix delete mode 100644 gluelogic/ise.nix diff --git a/gluelogic/default.nix b/gluelogic/default.nix index f532171..e4c60dc 100644 --- a/gluelogic/default.nix +++ b/gluelogic/default.nix @@ -1,12 +1,12 @@ { pkgs ? import {} }: let - artiqpkgs = import ../artiq-fast/pkgs/python-deps.nix { inherit (pkgs) lib fetchgit fetchFromGitHub python3Packages; misoc-new = true; }; ise = import ./ise.nix { inherit pkgs; }; - vivado = import ../artiq-fast/vivado.nix { inherit pkgs; }; + vivado = import ./vivado.nix { inherit pkgs; }; + fpgatools = import ./fpgatools.nix { inherit pkgs; }; buildUrukulCpld = {version, src}: pkgs.stdenv.mkDerivation { pname = "urukul-cpld"; inherit src version; - buildInputs = [(pkgs.python3.withPackages(ps: [artiqpkgs.migen]))] ++ (builtins.attrValues ise); + buildInputs = [(pkgs.python3.withPackages(ps: [fpgatools.migen]))] ++ (builtins.attrValues fpgatools.ise); phases = ["buildPhase" "installPhase"]; buildPhase = "python $src/urukul_impl.py"; installPhase = @@ -19,7 +19,7 @@ let buildMirnyCpld = {version, src}: pkgs.stdenv.mkDerivation { pname = "mirny-cpld"; inherit src version; - buildInputs = [(pkgs.python3.withPackages(ps: [artiqpkgs.migen]))] ++ (builtins.attrValues ise); + buildInputs = [(pkgs.python3.withPackages(ps: [fpgatools.migen]))] ++ (builtins.attrValues fpgatools.ise); phases = ["buildPhase" "installPhase"]; buildPhase = "python $src/mirny_impl.py"; installPhase = @@ -69,7 +69,7 @@ in fastino-fpga = pkgs.stdenv.mkDerivation { name = "fastino-fpga"; src = ; - buildInputs = [(pkgs.python3.withPackages(ps: [artiqpkgs.migen artiqpkgs.misoc]))] ++ [pkgs.yosys pkgs.nextpnr pkgs.icestorm]; + buildInputs = [(pkgs.python3.withPackages(ps: [fpgatools.migen fpgatools.misoc]))] ++ [pkgs.yosys pkgs.nextpnr pkgs.icestorm]; phases = ["buildPhase" "installPhase"]; buildPhase = "python $src/fastino_phy.py"; installPhase = @@ -88,7 +88,7 @@ in "" ''; - buildInputs = [ (pkgs.python3.withPackages(ps: [ artiqpkgs.migen artiqpkgs.misoc ])) ] ++ [ vivado ]; + buildInputs = [ (pkgs.python3.withPackages(ps: [ fpgatools.migen fpgatools.misoc ])) ] ++ [ fpgatools.vivado ]; buildPhase = "python phaser.py"; installPhase = '' diff --git a/gluelogic/fpgatools.nix b/gluelogic/fpgatools.nix new file mode 100644 index 0000000..c032e5b --- /dev/null +++ b/gluelogic/fpgatools.nix @@ -0,0 +1,84 @@ +{ pkgs, isePath ? "/opt/Xilinx/14.7/ISE_DS", vivadoPath ? "/opt/Xilinx/Vivado/2021.2" }: +rec { + ise = let + makeXilinxEnv = name: pkgs.buildFHSUserEnv { + inherit name; + targetPkgs = pkgs: ( + with pkgs; [ + ncurses5 + zlib + libuuid + xorg.libSM + xorg.libICE + xorg.libXrender + xorg.libX11 + xorg.libXext + xorg.libXtst + xorg.libXi + ] + ); + profile = + '' + source ${isePath}/common/.settings64.sh ${isePath}/common + source ${isePath}/ISE/.settings64.sh ${isePath}/ISE + ''; + runScript = name; + }; + in + pkgs.lib.attrsets.genAttrs ["xst" "ngdbuild" "cpldfit" "taengine" "hprep6"] makeXilinxEnv; + vivado = pkgs.buildFHSUserEnv { + name = "vivado"; + targetPkgs = pkgs: ( + with pkgs; [ + ncurses5 + zlib + libuuid + xorg.libSM + xorg.libICE + xorg.libXrender + xorg.libX11 + xorg.libXext + xorg.libXtst + xorg.libXi + ] ++ ( if pkgs ? libxcrypt-legacy then [ pkgs.libxcrypt-legacy ] else []) + ); + profile = "source ${vivadoPath}/settings64.sh"; + runScript = "vivado"; + }; + migen = pkgs.python3Packages.buildPythonPackage { + pname = "migen"; + version = "unstable-2021-12-16"; + src = pkgs.fetchFromGitHub { + owner = "m-labs"; + repo = "migen"; + rev = "ac703010eaa06ac9b6e32f97c6fa98b15de22b31"; + sha256 = "sha256-qpVj/yJf4hDDc99XXpVPH4EbLC8aCmEtACn5qNc3DGI="; + }; + propagatedBuildInputs = with pkgs.python3Packages; [ colorama ]; + }; + asyncserial = pkgs.python3Packages.buildPythonPackage { + pname = "asyncserial"; + version = "0.1"; + src = pkgs.fetchFromGitHub { + owner = "m-labs"; + repo = "asyncserial"; + rev = "d95bc1d6c791b0e9785935d2f62f628eb5cdf98d"; + sha256 = "0yzkka9jk3612v8gx748x6ziwykq5lr7zmr9wzkcls0v2yilqx9k"; + }; + propagatedBuildInputs = with pkgs.python3Packages; [ pyserial ]; + }; + misoc = pkgs.python3Packages.buildPythonPackage { + pname = "misoc"; + version = "unstable-2021-10-10"; + src = pkgs.fetchFromGitHub { + owner = "m-labs"; + repo = "misoc"; + rev = "f5203e406520874e15ab5d070058ef642fc57fd9"; + sha256 = "sha256-/2XTejqj0Bo81HaTrlTSWwInnWwsuqnq+CURXbpIrkA="; + fetchSubmodules = true; + }; + # TODO: fix misoc bitrot and re-enable tests + doCheck = false; + propagatedBuildInputs = with pkgs.python3Packages; [ pyserial jinja2 numpy asyncserial migen ]; + }; +} diff --git a/gluelogic/ise.nix b/gluelogic/ise.nix deleted file mode 100644 index 7633f3a..0000000 --- a/gluelogic/ise.nix +++ /dev/null @@ -1,31 +0,0 @@ -# Install ISE in /opt and add to /etc/nixos/configuration.nix: -# nix.sandboxPaths = ["/opt"]; - -{ pkgs, isePath ? "/opt/Xilinx/14.7/ISE_DS" }: - -let - makeXilinxEnv = name: pkgs.buildFHSUserEnv { - inherit name; - targetPkgs = pkgs: ( - with pkgs; [ - ncurses5 - zlib - libuuid - xorg.libSM - xorg.libICE - xorg.libXrender - xorg.libX11 - xorg.libXext - xorg.libXtst - xorg.libXi - ] - ); - profile = - '' - source ${isePath}/common/.settings64.sh ${isePath}/common - source ${isePath}/ISE/.settings64.sh ${isePath}/ISE - ''; - runScript = name; - }; -in - pkgs.lib.attrsets.genAttrs ["xst" "ngdbuild" "cpldfit" "taengine" "hprep6"] makeXilinxEnv