From 8de1dbdd5398f0fcb08f26bd7cae156df130e615 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 3 Jul 2019 23:01:31 +0800 Subject: [PATCH] build Urukul CPLD gateware --- artiq/pkgs/python-deps.nix | 13 +++++++------ hydra/artiq.nix | 17 +++++++++++++++++ urukul.nix | 6 ++++++ urukul/default.nix | 20 ++++++++++++++++++++ urukul/ise.nix | 31 +++++++++++++++++++++++++++++++ 5 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 urukul.nix create mode 100644 urukul/default.nix create mode 100644 urukul/ise.nix diff --git a/artiq/pkgs/python-deps.nix b/artiq/pkgs/python-deps.nix index 945b9d6..8e790eb 100644 --- a/artiq/pkgs/python-deps.nix +++ b/artiq/pkgs/python-deps.nix @@ -104,12 +104,13 @@ rec { migen = python3Packages.buildPythonPackage rec { name = "migen"; - src = fetchFromGitHub { - owner = "m-labs"; - repo = "migen"; - rev = "caab41469f5a0cb4014bc00a03898a0b76b00dd1"; - sha256 = "06zbbbjzlbyq2nlp13hyk8diw06zrffc37n4b6cxzk1i2aq8g83m"; - }; + #src = fetchFromGitHub { + # owner = "m-labs"; + # repo = "migen"; + # rev = "caab41469f5a0cb4014bc00a03898a0b76b00dd1"; + # sha256 = "06zbbbjzlbyq2nlp13hyk8diw06zrffc37n4b6cxzk1i2aq8g83m"; + #}; + src = /home/sb/migen; propagatedBuildInputs = with python3Packages; [ colorama sphinx sphinx_rtd_theme ]; diff --git a/hydra/artiq.nix b/hydra/artiq.nix index 959ed7d..e8f686a 100644 --- a/hydra/artiq.nix +++ b/hydra/artiq.nix @@ -38,6 +38,23 @@ "sinaraSystemsSrc": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/sinara-systems.git master 1", "emailresponsible": false }, "m-labs": { "type": "sysbuild", "value": "artiq:main:generated-nix", "emailresponsible": false } } + }, + "urukul": { + "enabled": 1, + "hidden": false, + "description": "Urukul CPLD gateware", + "nixexprinput": "nixScripts", + "nixexprpath": "urukul.nix", + "checkinterval": 172800, + "schedulingshares": 1, + "enableemail": false, + "emailoverride": "", + "keepnr": 10, + "inputs": { + "nixpkgs": { "type": "git", "value": "git://github.com/NixOS/nixpkgs-channels nixos-19.03", "emailresponsible": false }, + "nixScripts": { "type": "git", "value": "https://git.m-labs.hk/M-Labs/nix-scripts.git", "emailresponsible": false }, + "urukulSrc": { "type": "git", "value": "git://github.com/quartiq/urukul", "emailresponsible": false } + } } } EOF diff --git a/urukul.nix b/urukul.nix new file mode 100644 index 0000000..6e49e5b --- /dev/null +++ b/urukul.nix @@ -0,0 +1,6 @@ +{ pkgs ? import {} }: + +let + jobs = import ./urukul/default.nix { inherit pkgs; }; +in + builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) jobs diff --git a/urukul/default.nix b/urukul/default.nix new file mode 100644 index 0000000..db3726a --- /dev/null +++ b/urukul/default.nix @@ -0,0 +1,20 @@ +{ pkgs ? import {} }: +let + migen = (pkgs.callPackage ../artiq/pkgs/python-deps.nix {}).migen; + ise = import ./ise.nix { inherit pkgs; }; +in + { + urukul-cpld = pkgs.stdenv.mkDerivation { + name = "urukul-cpld"; + src = ; + buildInputs = [(pkgs.python3.withPackages(ps: [migen]))] ++ (builtins.attrValues ise); + phases = ["buildPhase" "installPhase"]; + buildPhase = "python $src/urukul_impl.py"; + installPhase = + '' + mkdir -p $out $out/nix-support + cp build/urukul.jed $out + echo file binary-dist $out/urukul.jed >> $out/nix-support/hydra-build-products + ''; + }; + } diff --git a/urukul/ise.nix b/urukul/ise.nix new file mode 100644 index 0000000..7633f3a --- /dev/null +++ b/urukul/ise.nix @@ -0,0 +1,31 @@ +# 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